25.03.2019, 20:27
Why not do it like this.
Code:
static bool:IsSpeeding[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
// Get the seat this determines everything about what the player is doing with
// the vehicle and if they are even in one
new seat = GetPlayerVehicleSeat(playerid);
// Is the player speeding?
if(IsSpeeding[playerid])
// Can't be speeding if not in a vehicle
if(seat == -1)
IsSpeeding[playerid] = false;
// Player is driving
else if(seat == 0)
{
// Have they stopped speeding yet?
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) <= 210)
{
// Not speeding anymore let them know
IsSpeeding[playerid] = false;
SendClientMessage(playerid, COLOR_GREEN, "You have stopped speeding watch out for the cops");
}
}
}
// Player is not speeding
else
{
// Player is driving
if(seat == 0)
{
// Player is speeding issue the warning set as wanted
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 210)
{
SendClientMessage(playerid, COLOR_RED, "You are drivin too fast, thw cops are going to chase you now!");
IsWanted[playerid] = 1;
}
}
}
return 1;
}

