17.05.2011, 17:18
Ooh okay,
So if you have "for(new i; i < MAX_PLAYERS; i++)" in your callback, all the "playerid's" are changed by "i"?
Edit:
Still got a little problem, when the car health is below 350, it sets the player health back to 349, and gives a message "Your Engine Died, etc etc etc". But the only thing is, it keeps spamming the message Your Engine Died.. Is there somehow i can get rid of this? (It is the same if the car is repaired
So if you have "for(new i; i < MAX_PLAYERS; i++)" in your callback, all the "playerid's" are changed by "i"?
Edit:
Still got a little problem, when the car health is below 350, it sets the player health back to 349, and gives a message "Your Engine Died, etc etc etc". But the only thing is, it keeps spamming the message Your Engine Died.. Is there somehow i can get rid of this? (It is the same if the car is repaired
pawn Код:
public CarWrecked()
{
for(new i; i < MAX_PLAYERS; i++)
{
new Float:VehHealth;
new PlayerVehicle;
PlayerVehicle = GetPlayerVehicleID(i);
GetVehicleHealth(PlayerVehicle, VehHealth);
if(IsPlayerInAnyVehicle(i))
{
if(VehHealth < 350)
{
SetVehicleParamsEx(PlayerVehicle, false, true, true, true, false, false, false);
TogglePlayerControllable(i,0);
SendClientMessage(i, orange, "Your engine died. Please call a repairsman to repair it");
SetVehicleHealth(PlayerVehicle, 349);
return 1;
} else if(VehHealth > 998) {
SetVehicleParamsEx(PlayerVehicle, true, false, false, false, false, false, false);
TogglePlayerControllable(i, 1);
SendClientMessage(i, orange, "Your engine have been fixed.");
SendClientMessage(i, orange, "You gave the repairsman 500$.");
return 1;
}
}
}
return 1;
}