11.02.2012, 15:00
How to check if a player's position has been drastically changed without the use of timer?
new Float:PlayerPosOld[MAX_PLAYERS][3];
new Float:PosNew[3];
new Float:PosDelta[3];
GetPlayerPos(playerid,PosNew[playerid][0],PosNew[playerid][1],PosNew[playerid][2]);
PosDelta[0]=PosNew[0]-PlayerPosOld[playerid][0];
PosDelta[1]=PosNew[0]-PlayerPosOld[playerid][0];
PosDelta[2]=PosNew[0]-PlayerPosOld[playerid][0];
PlayerPosOld[MAX_PLAYERS][0]=PosNew[0];
PlayerPosOld[MAX_PLAYERS][1]=PosNew[1];
PlayerPosOld[MAX_PLAYERS][2]=PosNew[2];
1 word: delta.
pawn Код:
pawn Код:
oh, maybe adding this in another callback can help to avoid lag. the OnPlayerKeyStateChange fits better imo - no player can move without pressing at least 1 key. |