Guten Tag,
heute dachte ich mir ein /opark System zu machen...
Fangen wir an:
Bei
enum dtc_PlayerCar
schreibt ihr
CarArrest,
Dann bei:
enum pInfo
schreibt ihr:
pRest,
Bei:
OnPlayerCommandText
if(strcmp(cmd, "/oaufbrechen", true) == 0)
{
if(PlayerInfo[playerid][pMember] == 24 || PlayerInfo[playerid][pLeader] == 24)
{
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid, pX, pY, pZ);
new Float:vX, Float:vY, Float:vZ;
new Found = 0;
new vid = 0;
while((vid < MAX_VEHICLES) && (!Found))
{
vid++;
GetVehiclePos(vid,vX,vY,vZ);
if((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0) && (floatabs(pZ-vZ)<7.0) && (vid!=GetPlayerVehicleID(playerid)))
{
PutPlayerInVehicle(playerid, vid, 0);
SendClientMessage(playerid, COLOR_RED, "*Fahrzeug erfolgreich aufgebrochen!");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsACop(i))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "HQ: Ordnungsbeamter: %s hat ein Fahrzeug aufbrechen müssen, weil es abgesperrt war!", sendername);
SendClientMessage(playerid, TEAM_BLUE_COLOR, string);
}
}
}
}
if(!Found)
{
SendClientMessage(playerid, COLOR_GRAD1, "Kein Fahrzeug in der Nähe!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Du bist kein Ordnungsbeamter!");
}
return 1;
}
if(strcmp("/unopark", cmd, true, 10) == 0)
{
if(PlayerInfo[playerid][pMember] == 24||PlayerInfo[playerid][pLeader] == 24)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new trailercar2 = GetPlayerVehicleID(playerid);
new carowner = GetDtCarOwner(trailercar2);
new slot = GetDtCarOwnerSlot(carowner,trailercar2);
if(PlayerCar[carowner][slot][CarArrest] == 1 && PlayerInfo[carowner][pRest] == 1)
{
PlayerCar[carowner][slot][CarPos_x] = 935.7244;
PlayerCar[carowner][slot][CarPos_y] = -1207.2697;
PlayerCar[carowner][slot][CarPos_z] = 17.2726;
PlayerCar[carowner][slot][CarArrest] = 0;
PlayerCar[carowner][slot][CarRotate] = 270;
if(carowner != 555)
{
OnPlayerCarUpdate(carowner);
SendClientMessage(carowner, COLOR_WHITE, "Ihr Auto wurde von einen Ordnungsbeamten freigegeben, sie können es nun am Roten Marker abholen!");
PlayerInfo[carowner][pRest] = 0;
SetPlayerCheckpoint(carowner,935.7244,-1207.2697,17.2726, 8.0);
SetVehicleToRespawn(trailercar2);
SetVehiclePos(trailercar2,935.7244,-1207.2697,17.2726);
SetVehicleVirtualWorld(trailercar2, 0);
SetTimerEx("PlayerCarSpawn",1000,0,"i",carowner);
SetPlayerPos(playerid, 935.7244,-1207.2697,17.2726);
}
}
}
}
return 1;
}
if (strcmp("/opark", cmd, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 525 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(PlayerInfo[playerid][pMember] == 24||PlayerInfo[playerid][pLeader] == 24)
{
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessage(playerid, COLOR_GREY, " An deinem Abschleppwagen ist kein Auto angehängt!");
return 1;
}
new trailercar = GetVehicleTrailer(GetPlayerVehicleID(playerid));
new Float:X,Float:Y,Float:Z;
new Float:z_rot;
GetVehiclePos(trailercar, X,Y,Z);
GetVehicleZAngle(trailercar, z_rot);
new carowner = GetDtCarOwner(trailercar);
new slot = GetDtCarOwnerSlot(carowner,trailercar);
PlayerCar[carowner][slot][CarPos_x] = X;
PlayerCar[carowner][slot][CarPos_y] = Y;
PlayerCar[carowner][slot][CarPos_z] = Z;
PlayerCar[carowner][slot][CarArrest] = 1;
PlayerCar[carowner][slot][CarRotate] = z_rot;
if(carowner != 555)
{
OnPlayerCarUpdate(carowner);
SendClientMessage(carowner, COLOR_WHITE, " Das Oamt hat dein Fahrzeug abgeschleppt, geh zur Oamt-Base und Frage ihn ob er es wieder freigibt!");
PlayerInfo[carowner][pRest] = 1;
SetTimerEx("PlayerCarSpawn",1000,0,"i",carowner);
}
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_YELLOW, " Du hast das Fahrzeug erfolgreich abgeschleppt!");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Du bist kein Mitglied des Ordnungsamtes!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Du musst einen Abschleppwagen fahren!");
}
return 1;
}
Viel Spaß damit
MFG
Hydra