Guest User

Untitled

a guest
Jun 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public UpdatePlayerPos()
  2. {
  3. new Float:Pos[3];
  4. foreach(Player, i)
  5. {
  6. if(!IsPlayerConnected(i)) continue;
  7. GetPlayerPos(i, Pos[0], Pos[1], Pos[2]);
  8. if(GetPlayerState(i) == PLAYER_STATE_ONFOOT)
  9. {
  10. PlayerInfo[i][pDistance] = floatround(floatsqroot(GetPVarFloat(i, "OLDX") -Pos[0]) * (GetPVarFloat(i, "OLDX") -Pos[0]) + (GetPVarFloat(i, "OLDY") -Pos[1]) * (GetPVarFloat(i, "OLDY") -Pos[1]) + (GetPVarFloat(i, "OLDZ") -Pos[2]) * (GetPVarFloat(i, "OLDZ") -Pos[2]), floatround_floor);
  11. SetPVarFloat(i, "OLDX", Pos[0]);
  12. SetPVarFloat(i, "OLDY", Pos[1]);
  13. SetPVarFloat(i, "OLDZ", Pos[2]);
  14. }
  15. }
  16. return 1;
  17. }
Add Comment
Please, Sign In to add comment