SA-MP Forums Archive
How to check is player pos has changed? - 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: How to check is player pos has changed? (/showthread.php?tid=227902)



How to check is player pos has changed? - ajwar - 18.02.2011

Hi i wondering about how to make a check with pVars which will check is player position has changed? I will use this in timer...


Re: How to check is player pos has changed? - RyDeR` - 18.02.2011

The part where you get the positions and save the positions in with PVars.
pawn Код:
new
    Float: pPos[3]
;
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);

SetPVarFloat(playerid, "posX", pPos[0]);
SetPVarFloat(playerid, "posY", pPos[1]);
SetPVarFloat(playerid, "posZ", pPos[2]);
The part where you check if it's changed.
pawn Код:
new
    Float: pPos[3]
;
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);

if(pPos[0] != GetPVarFloat(playerid, "posX") || pPos[1] != GetPVarFloat(playerid, "posY") || pPos[2] != GetPVarFloat(playerid, "posZ"))
{
    /* Position is changed... */
}
Another options is to use floatcmp.


Re: How to check is player pos has changed? - ajwar - 18.02.2011

thank's