new LoseHP[MAX_PLAYERS];
forward NegativeDown(playerid);
public OnPlayerUpdate(playerid) //
{
if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z))
{
LoseHP[playerid] = SetTimerEx("NegativeDown",1000,1,"i",playerid);
}
return 1;
}
public NegativeDown(playerid)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health - 1.5); //
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(LoseHP[playerid]);
return 1;
}
: error 017: undefined symbol "MAX_PLAYERS" ) : error 009: invalid array size (negative, zero or out of bounds) : warning 235: public function lacks forward declaration (symbol "OnPlayerUpdate") : error 017: undefined symbol "IsPlayerInRangeOfPoint" : error 017: undefined symbol "SetTimerEx" : error 017: undefined symbol "GetPlayerHealth" : error 017: undefined symbol "SetPlayerHealth" : warning 235: public function lacks forward declaration (symbol "OnPlayerDisconnect") : error 017: undefined symbol "KillTimer"
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
IsPlayerInRangeOfPoint( playerid, 10.0, 69.000, 1337.000, 13.370 )
|
Also, it doesn't seem to be a good idea to start a timer at OnPlayerUpdate.. since that callback is called about 30x each second for each player..
|
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z))
{
if(!GetPVarInt(playerid,"RadiationTimerWorking"))
{
LoseHP[playerid] = SetTimerEx("NegativeDown",1000,1,"i",playerid);
SetPVarInt(playerid,"RadiationTimerWorking",1);
}
}
else SetPVarInt(playerid,"RadiationTimerWorking",0);
return 1;
}