Hey ich bekomm das nicht hin den Motorbefehl zu "reparieren". Kann mal wer drüber schauen und eventuell den Fehler finden?
stock SwitchEngine(playerid)
{
new sendername[MAX_PLAYER_NAME];
new string[200];
GetPlayerName(playerid,sendername,sizeof(sendername));
if(IsPlayerInAnyVehicle(playerid))
{
if(Adminmode[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 3 || Derbymode[playerid] == 1|| Eventmode[playerid] == 1)
{
new en, li, ala, doo, boo, boot, obj;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
if(en == VEHICLE_PARAMS_OFF)
{
VehInfo[vehicleid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[vehicleid][vid], en, li, ala, doo, boo, boot, obj);
SetVehicleParamsEx(PlayerCar[vehicleid][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehicleid][Licht] = 1;
return 1;
}
else if(en == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, li, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0;
}
}
for(new i = 0; i<MAX_VEHICLES; i++)
{
if(PlayerInfo[playerid][pArbeiter]!= 24 || PlayerInfo[playerid][pChef]!= 24)
{
if(PlayerCar[vid] == GetPlayerVehicleID(playerid))
{
if(PlayerCar[Towed] == 1)
{
SendClientMessage(playerid, GRAU, "Dieses Fahrzeug wurde abgeschleppt! Du kannst das Fahrzeug für 2000€ per /auslösen wieder auslösen!");
SendClientMessage(playerid, GRAU, "Mit /exit kannst du das Fahrzeug verlassen.");
TogglePlayerControllable(playerid, 0);
}
}
}
}
if(PlayerInfo[playerid][pJob]==17)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 538)
{
new en, li, ala, doo, boo, boot, obj;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
if(en == VEHICLE_PARAMS_ON) { SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, li, VEHICLE_PARAMS_OFF, doo, boo, boot, obj); VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0; }
else if(en == VEHICLE_PARAMS_OFF) { SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, li, VEHICLE_PARAMS_OFF, doo, boo, boot, obj); VehInfo[GetPlayerVehicleID(playerid)][Motor] = 1; }
}
}
if(Refueling[playerid]) { SendClientMessage(playerid, Grey, "Du kannst den Motor während dem Tanken nicht stoppen/starten!"); return 1; }
new engine, lights, alarm, doors, bonnet, boot, obj, Float:health;
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
for(new ii = 0; ii<MAX_VEHICLES; ii++)
{
new str[128], vehid = GetPlayerVehicleID(playerid);
format(str, sizeof str, "/Cars/%d.ini", ii);
if(fexist(str))
{
if(PlayerCar[ii][vid] == vehid)
{
if(PlayerCar[ii][Broken]) { SendClientMessage(playerid, Grey, "Du kannst den Motor nicht starten, da du den falschen Kraftstoff getankt hast!"); SendClientMessage(playerid, Grey, "Du musst per /Service Mechaniker oder /Service Abschlepper einen Mechaniker/Abschlepper rufen, der dir deinen Tank auspumpt!"); return 1; }
if(VehInfo[vehid][Motor])
{
VehInfo[vehid][Motor] = 0;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s stoppt den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 0;
return 1;
}
if(PlayerCar[ii][Fuel] > 0 && health > 30)
{
if(!VehInfo[vehid][Motor])
{
if(!strcmp(PlayerCar[ii][Key], "Staat", false) && !PlayerCar[ii][JobCar] && !PlayerCar[ii][FrakCar])
{
if(!VehInfo[vehid][Motor])
{
VehInfo[vehid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 1;
return 1;
}
return 1;
}
else if(PlayerCar[ii][FrakCar])
{
if(PlayerCar[ii][Frak] == PlayerInfo[playerid][pArbeiter] || PlayerInfo[playerid][pChef] == PlayerCar[ii][Frak])
{
if(!VehInfo[vehid][Motor])
{
VehInfo[vehid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 1;
return 1;
}
return 1;
}
return 1;
}
else if(PlayerInfo[playerid][pArbeiter] == 24 && PlayerInfo[playerid][pChef] == 24)
{
VehInfo[vehid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 1;
return 1;
}
else if(Mission[playerid] > 1)
{
if(PlayerCar[ii][NSID] == Mission[playerid])
{
new en, li, ala, doo, boo;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
if(en == VEHICLE_PARAMS_ON)
{
VehInfo[vehicleid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[vehicleid][vid], en, li, ala, doo, boo, boot, obj);
SetVehicleParamsEx(PlayerCar[vehicleid][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehicleid][Licht] = 1;
}
else if(en == VEHICLE_PARAMS_OFF)
{
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, li, ala, doo, boo, boot, obj);
VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0;
}
}
}
else if(RCAuto[playerid] > 1)
{
if(PlayerCar[ii][NSID] == RCAuto[playerid])
{
new en, li, ala, doo, boo;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
if(en == VEHICLE_PARAMS_ON)
{
VehInfo[vehicleid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[vehicleid][vid], en, li, ala, doo, boo, boot, obj);
SetVehicleParamsEx(PlayerCar[vehicleid][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehicleid][Licht] = 1;
}
else if(en == VEHICLE_PARAMS_OFF)
{
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, li, ala, doo, boo, boot, obj);
VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0;
}
}
}
else if(PlayerCar[ii][JobCar])
{
if(PlayerInfo[playerid][pJob] == PlayerCar[ii][Job])
{
if(!VehInfo[vehid][Motor])
{
VehInfo[vehid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 1;
return 1;
}
return 1;
}
return 1;
}
else if(!strcmp(PlayerCar[ii][Key], pn(playerid), false) || PlayerCar[ii][NSID] == PlayerInfo[playerid][pRentCarKey])
{
if(!VehInfo[vehid][Motor])
{
VehInfo[vehid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 1;
return 1;
}
return 1;
}
else if(PlayerCar[ii][Towed] == 1)
{
if(PlayerInfo[playerid][pArbeiter] == 24 || PlayerInfo[playerid][pChef] == 24)
{
if(!VehInfo[vehid][Motor])
{
VehInfo[vehid][Motor] = 1;
GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehInfo[vehid][Licht] = 1;
return 1;
}
}
return 1;
}
}
return 1;
}
else
{
SendClientMessage(playerid,GRAU,"** Du kannst den Motor nicht mit leerem Tank starten!");
}
return 1;
}
}
}
}
return 1;
}