31.03.2015, 00:02
PHP код:
forward CheckCarHealth();
public CheckCarHealth()
{
new string[256];
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new sendername[MAX_PLAYER_NAME];
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
new carro = GetPlayerVehicleID(i);
new mot, lu, alar, por, cap, porma, ob;
if(health <= 400)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i, 1);
SendClientMessage(i, COLOR_LIGHTBLUE, "Seu veiculo quebrou, tente ligar novamente ou ligue para um mecanico!");
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* O veiculo de %s quebrou.", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
}
}
}
}
return 1;
}