Ich habe das Problem, dass ich die Commands ( /lights und /engine) immer doppelt eingeben muss..
Das heisst, Auto aus: /engine -> Auto an. erneut /engine "starts engine" -> auto immernoch an (anstatt das es wieder ausgeht nochmals engine: Auto aus. erneut engine: "turns off the engine" obwohl er schon aus ist!
if(strcmp(cmd, "/lights", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(lights == 0)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,1,alarm,doors,bonnet,boot,objective);
return 1;
}
else
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,0,alarm,doors,bonnet,boot,objective);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not in any vehicle.");
return 1;
}
}
if(strcmp(cmd, "/engine", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(engine == 0)
{
new start_try = random(2);
if(LStep[playerid] == 7)
{
format(string, sizeof(string), "%s takes his keys and starts the engine of the driving test Vehicle.", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);//engine[GetPlayerVehicleID(playerid)] = 1;
TogglePlayerControllable(playerid, 1);
ClearChat(playerid);
SendClientMessage(playerid, COLOR_WHITE, "Great, good luck with the driving test!");
new car = GetPlayerVehicleID(playerid);
ClearChat(playerid);
SendClientMessage(playerid, COLOR_SYSTEM, "Ok,Seems like you got it going on, You're going to go around the checkpoints in 3 minute, GO!");
SendClientMessage(playerid, COLOR_SYSTEM, "Note - If you leave the vehicle, your test will be automaticly over!");
//SendClientMessage(playerid, COLOR_LIGHTBLUE, "IMPORTANT - If you notice your driving is bad, This is because your driving skill is low. Increase it by passing the test!");
ltimer[playerid] = SetTimerEx("Ttimesup", 180000, 0, "d", playerid);
LStep[playerid] = 9;
SetVehiclePos(car, -2046.8097,-97.6861,35.1641);
PutPlayerInVehicle(playerid, car, 0);
SetPlayerCheckpoint(playerid, -2057.8716,-68.3647,34.7350, 5.0);
TogglePlayerControllable(playerid, 1);
TakingDrivingTest[playerid] = 1;
SetTimerEx("DrivingTestTimer", 1000, 0, "d", playerid);
return 1;
}
if(start_try == 0)
{
if(RandTry < 2)
{
format(string, sizeof(string), "%s try to start engine, but fail's", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
RandTry++;
return 1;
}
else
{
format(string, sizeof(string), "%s started engine of vehicle", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);//engine[vehicleid] = 1;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
// TogglePlayerControllable(playerid, 1);
}
return 1;
}
format(string, sizeof(string), "%s started engine of vehicle", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);//engine[vehicleid] = 1;
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
format(string, sizeof(string), "%s stop engine of vehicle", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);//engine[vehicleid] = 0;
//TogglePlayerControllable(playerid, 0);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle.");
return 1;
}
}
Alles anzeigen
Das Problem besteht, seit ich meien scriptvorlage vom freeze prizip bei/engine auf wirkliches engine an/aus umgestellt habe