15.09.2014, 14:55
pawn Код:
new playerid;
public CheckGas()
{
for(new i=0;i<MAXPLAYERSJFS;i++)
{
if(IsPlayerConnected(i))
{
new vehicle = GetPlayerVehicleID(i);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(Gas[vehicle] >= 1)
{
Gas[vehicle]--;
}
if(Gas[vehicle] < 1)
{
SemGasolina[i] = 1;
TogglePlayerControllable(i, 1);
SendClientMessage(i, -1, "[INFO] Acabou a Gasolina ! Chame um Mecanico /servico mecanico");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
Parameters:
(playerid, toggle)
playerid The ID of the player to toggle the controllability of
toggle 0 to make them uncontrollable, 1 to make them controllable.