SA-MP Forums Archive
Radiation zones? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Radiation zones? (/showthread.php?tid=559684)



Radiation zones? - Crystallize - 24.01.2015

Hi guys , i'm in need of some help , i'm trying to make some radiation zones but when I compile it gives me lots of errors here's the script
Code:
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;
}
Here are the errors
Code:
 : 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"
Could anybody help me?


Re: Radiation zones? - Crystallize - 24.01.2015

Bump.


Re: Radiation zones? - Crystallize - 25.01.2015

Bump


Re: Radiation zones? - Smileys - 25.01.2015

Code:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
you need to fill in the range and coordinates of your radiation zone.

like:

Code:
IsPlayerInRangeOfPoint( playerid, 10.0, 69.000, 1337.000, 13.370 )



Re: Radiation zones? - Schneider - 25.01.2015

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..


Re: Radiation zones? - Crystallize - 25.01.2015

I already did it lol just didn't post the cords , but the errors are still the same
Quote:
Originally Posted by Schneider
View Post
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..
What I should use?


Re: Radiation zones? - Schneider - 25.01.2015

Have you included a_samp?


Re: Radiation zones? - Crystallize - 25.01.2015

Nope :/ that's all the code i've been trying to compile


Re: Radiation zones? - Schneider - 25.01.2015

Well, you should at least #include <a_samp> since the basic functions are defined in that include.


Re: Radiation zones? - zaibaslr2 - 25.01.2015

pawn Code:
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;
}
This will prevent the timer from from bugging