PlayerToPoint works just for me.
#1

Look. I'm creating entrances and exits with PlayerToPoint.
Here is my code:
Top of script:
Код:
forward Doors(playerid);
After OnGameModeInit
Код:
SetTimer("Doors",1000,true);
And anywhere in GM:
Код:
public Doors(playerid)
{
 	if(PlayerToPoint(1,playerid,-2026.5660,-102.0659,35.1641)) // DMV
 	{
 	SetPlayerInterior(playerid,3);
 	SetPlayerPos(playerid,1494.4567,1305.2220,1093.2891);
 	SetPlayerFacingAngle(playerid,359.6967);
	return 1;
	}
	else if(PlayerToPoint(1,playerid,1494.4486,1303.5806,1093.2891))
 	{
 	SetPlayerInterior(playerid,0);
 	SetPlayerPos(playerid,-2026.5931,-100.3700,35.1641);
 	SetPlayerFacingAngle(playerid,360);
	return 1;
	}
	return 1;
}
Everythings works, but just for me. I can enter in DMV, but other peoples can't. Where is the problem?
Thanks for help.
Reply
#2

You should check all players.

pawn Код:
public Doors()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerToPoint(1,i,-2026.5660,-102.0659,35.1641)) // DMV
            {
                SetPlayerInterior(i,3);
                SetPlayerPos(i,1494.4567,1305.2220,1093.2891);
                SetPlayerFacingAngle(i,359.6967);
                return 1;
            }
            else if(PlayerToPoint(1,i,1494.4486,1303.5806,1093.2891))
            {
                SetPlayerInterior(i,0);
                SetPlayerPos(i,-2026.5931,-100.3700,35.1641);
                SetPlayerFacingAngle(i,360);
                return 1;
            }
            return 1;
        }
    }
}
Reply
#3

By the way, why don't you use IsPlayerInRangeOfPoint? It's a new replacement for PlayerToPoint but it's now a sa-mp native.
Reply
#4

I already tested these codes, but both didn't work. ( I'm soon test and PlayerIsInRange ). But i see the real bug. Who is joining first in server, just that player can enter there. If someone join into my server and second goona be me, then JUST that other player can enter.. :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)