16.02.2019, 20:49
Tente substituir seu sistema por este
topo gm
OnPlayerDisconnect:
final da gm:
public OnPlayerStateChange
final da gm
topo gm
Код:
forward UpdatePlayecar(playerid); new bool:Playercar[MAX_PLAYERS]; new PlayerTimerCar[MAX_PLAYERS];
Код:
if (Playercar[playerid]) { KillTimer(PlayerTimerCar[playerid]); }
Код:
public UpdatePlayercar(playerid) { new playervehicle; if ( (playervehicle = GetPlayerVehicleID(playerid)) != INVALID_VEHICLE_ID) { new string_velo[15]; new lu, alar, por, cap, porma, ob; new carro = GetPlayerVehicleID(playerid); static Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid),health); if(health <= 350) { SendClientMessage(playerid, VERMELHO_COR, "Seu motor estragou"); SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob); HidePlayercar(playerid); Playercar[playerid] = false ; KillTimer(PlayerTimerCar[playerid]); return 0; } } return 1; }
Код:
if ( newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) { ParouDeFunfar(playerid) ; } else { HidePlayercar(playerid) ; }
Код:
stock ParouDeFunfar(playerid) { if ( Playercar[playerid] ) { return 0; } Playercar[playerid] = true ; PlayerTimerCar[playerid] = SetTimerEx("UpdatePlayercar", 100, true, "i", playerid); return 1; } stock HidePlayercar(playerid) { if ( !Playercar[playerid] ) { return 0; } Playercar[playerid] = false ; KillTimer(PlayerTimerCar[playerid]); return 1; }