SA-MP Forums Archive
Help Range Point - 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: Help Range Point (/showthread.php?tid=449555)



Help Range Point - kalanerik99 - 09.07.2013

Hi!

I want to make that if player will be in this pos1 and he isn't VIP he vill be replaced to replace 1
The same to pos 2

PHP код:
if(IsPlayerInRangeOfPoint(playerid20.0//pos1))
{
if(
PlayerInfo[playerid][VIP])

Pos 1
Код:
-2636.7231,1403.7640,906.4609
Replace 1
Код:
-2625.1719,1409.0491,7.1016
Pos 2
Код:
-2661.0100,1415.4069,922.1953
Replace 2
Код:
-2661.8076,1426.2075,23.8984



Re : Help Range Point - yusei - 09.07.2013

PHP код:
if(PlayerInfo[playerid][VIP] == 0)
{
    if(
IsPlayerInRangeOfPoint(playerid5.0, -2636.7231,1403.7640,906.4609))
    {
        
SetPlayerPos(playerid,-2625.1719,1409.0491,7.1016);
        return 
true;
    }
    if(
IsPlayerInRangeOfPoint(playerid5.0, -2661.0100,1415.4069,922.1953))
    {
        
SetPlayerPos(playerid,-2661.8076,1426.2075,23.8984);
        return 
true;
    }




Re: Help Range Point - kalanerik99 - 09.07.2013

under onplayerupdate


Re : Help Range Point - yusei - 09.07.2013

better under OnPlayerStateChange


Re: Help Range Point - kalanerik99 - 09.07.2013

now I have got this but nothing happens



Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(PlayerInfo[playerid][VIP] == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, -2636.7231,1403.7640,906.4609))
    {
        SetPlayerPos(playerid,-2625.1719,1409.0491,7.1016);
        return true;
    }
    if(IsPlayerInRangeOfPoint(playerid, 5.0, -2661.0100,1415.4069,922.1953))
    {
        SetPlayerPos(playerid,-2661.8076,1426.2075,23.8984);
        return true;
    }
}
return 0;
}



Re: Help Range Point - Konstantinos - 09.07.2013

Because that callback doesn't get called if player's state doesn't change. Use a timer for it or in OnPlayerUpdate, but be careful. That callback is called too frequently. Don't add a lot of code in it. And in case you use OnPlayerUpdate callback, return 1 because 0 will make the players desynced to everyone else.


Re: Help Range Point - kalanerik99 - 09.07.2013

Thanks all now works