Quote:
Originally Posted by Babul
1 word: delta.
pawn Код:
new Float:PlayerPosOld[MAX_PLAYERS][3];
OnPlayerUpdate:
pawn Код:
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];
after this, the PosDelta will have stored the difference betwen each position change. ignoring the [2] can be, i doubt that any player teleports into the sky (or below ground)...
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.
|
It's really embarrassing for me to forget it. You deserve reputation from me.