PlayerToPoint works just for me. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PlayerToPoint works just for me. (
/showthread.php?tid=104360)
PlayerToPoint works just for me. -
Martin_M - 24.10.2009
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.
Re: PlayerToPoint works just for me. -
MadeMan - 24.10.2009
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;
}
}
}
Re: PlayerToPoint works just for me. -
MenaceX^ - 24.10.2009
By the way, why don't you use IsPlayerInRangeOfPoint? It's a new replacement for PlayerToPoint but it's now a sa-mp native.
Re: PlayerToPoint works just for me. -
Martin_M - 24.10.2009
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.. :/