02.02.2013, 14:50
Hey Guys,
I have this code:
The first script suppost to turn off the engine,freeze the player,and tell everyone around that the engine is broken when the car have under 50HP .
The second script should release the player from freeze and let him turn the engine on when the car have over 50HP.
The problem is that it does'nt work,I don't get any errors..
A little help will be nice
I have this code:
pawn Код:
public CheckCarHealth()
{
new string[256];
new sendername[MAX_PLAYER_NAME];
for (new i=0; i < PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
new vehicle = GetPlayerVehicleID(i);
if(health < 50)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i, COLOR_LIGHT_BLUE, "Your vehicle is broken, start the engine up or call a mechanic! (/exit to leave a car)");
engineOn[vehicle] = 0;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* Vehicle engine brakes down (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
if(health > 50)
{
engineOn[vehicle] = 1;
TogglePlayerControllable(i, 1);
}
}
}
}
The second script should release the player from freeze and let him turn the engine on when the car have over 50HP.
The problem is that it does'nt work,I don't get any errors..
A little help will be nice