11.02.2009, 13:00
There's a trick for that called pseudocode, it's really all about translating the code into english
becomes
[quote]
loop through all players
- if the player ID isn't connected -> go to the next player ID
- if the player isn't in any vehicle, or if the player isn't logged in as an RCON admin -> go to the next player ID
- create a variable named fVehicleHealth and store the players current vehicle health in it
- if the health of the car reaches a value of below 400
-- set the vehicle health back to 1000
end loop - next player ID
Код:
for(new i; i<200; i++)
{
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerInAnyVehicle(i) || !IsPlayerAdmin(i)) continue;
new Float:fVehicleHealth;
GetVehicleHealth(GetPlayerVehicleID(i),fVehicleHealth);
if(fVehicleHealth < 400)
SetVehicleHealth(GetPlayerVehicleID(i),1000.0);
}
[quote]
loop through all players
- if the player ID isn't connected -> go to the next player ID
- if the player isn't in any vehicle, or if the player isn't logged in as an RCON admin -> go to the next player ID
- create a variable named fVehicleHealth and store the players current vehicle health in it
- if the health of the car reaches a value of below 400
-- set the vehicle health back to 1000
end loop - next player ID

