22.05.2014, 13:37
I was wondering if someone could help me out by making a code for radiation levels and when they get to 100, you start to lose health.
radlevel[MAX_PLAYERS]; // Setting a var to store radiation level
forward radcheck(); // forwarding timer
SetTimer("radcheck", 5000, false); // Set a timer of 5000 miliseconds (5 seconds)
radlevel[playerid] +5; // the 5 is the value u want to increase change it if you want
public radcheck()
{
for(new i = 0; i < MAX_PLAYERS; i++) //looping through player
{
if(IsPlayerConnected(i)) //checking if player is connected
{
if(radlevel[i] > 100) //checking if player has 100 radiation level
{
new Float:health;
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-5) // reducing health!! at the rate of 5 HP per 5 seconds
}
}
}
}
Sure first add this at top :
pawn Код:
pawn Код:
pawn Код:
pawn Код:
|