SA-MP Forums Archive
need help InRangeOfPoint - 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: need help InRangeOfPoint (/showthread.php?tid=507152)



need help InRangeOfPoint - iThePunisher - 16.04.2014

ok im making a something using IsPlayerInRangeOfPoint
but how can add if player leave the rangeofpoint he will spawn or die??


Re: need help InRangeOfPoint - PrivatioBoni - 16.04.2014

pawn Code:
if(!IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
   SetPlayerHealth(playerid, 0.0);
}
You can put this under a timer or something, which is called frequently.


AW: need help InRangeOfPoint - BiosMarcel - 16.04.2014

like that?:
PHP Code:
public OnPlayerUpdate(playerid)
{
    If(!
IsPlayerInRangeOfPoint(playerid15.00.00.00.0))
    {
        
setPlayerHealth(playerid,0.0);
    }




Re: need help InRangeOfPoint - iThePunisher - 16.04.2014

@[Bios]Marcel im so sure At onplayerupdate it will start spam so much.

@PrivatioBoni, i already know how is this code (!IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
but i dont know where to put it ,
i want to add example if player leave the robbery point he will faild to the bank robbery


AW: need help InRangeOfPoint - BiosMarcel - 16.04.2014

create a Timer for every Player which checks there Position every 500 milliseconds or whatever
or create a global timer


AW: need help InRangeOfPoint - BiosMarcel - 16.04.2014

PHP Code:
new RobT[MaxPlayers];
CMD:Rob(playerid,params[])
{
//the rob command ....
    
RobT[playerid] = SetTimerEx("RobCheck"500true"i"playerid);
}
forward RobCheck(playerid);
public 
RobCheck(playerid)
{
    if(
IsRobbing)
    {
        if(!
isinrangeof.....)
        {
        
setPlayerHealth(playerid,0.0);
        
KillTimer(RobT[playerid]);
        }
    }




Re: need help InRangeOfPoint - iThePunisher - 16.04.2014

Edit : nvm i will find another way about this...
anyway thanks for taking your time trying to help me.
+rep