Help Range Point
#1

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
Reply
#2

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;
    }

Reply
#3

under onplayerupdate
Reply
#4

better under OnPlayerStateChange
Reply
#5

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;
}
Reply
#6

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

Thanks all now works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)