nbdyson

UnstickPlayer

Mar 6th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.63 KB | None | 0 0
  1. stock UnstickPlayer(playerid)
  2. {
  3.     new Float:x, Float:y, Float:z,
  4.      Float:otherx, Float:othery, Float:otherz;
  5.      
  6.     GetPlayerPos(playerid, x, y, z); //Get possibly stuck player's position
  7.      
  8.     foreach(new i : Player) //Loop through all connected players and...
  9.     {
  10.         if(i != playerid) //... if they aren't the stuck player...
  11.         {
  12.             GetPlayerPos(playerid, otherx, othery, otherz); //... get their position
  13.  
  14.             if(IsPlayerInRangeOfPoint(playerid, 0.1, otherx, othery, otherz)) //and if the stuck player is within a range of 0.1 to any other players
  15.             {
  16.                 SetPlayerPos(playerid, x, y+0.5, z); // move them slightly
  17.             }
  18.         }
  19.     }
  20.    
  21.     return 1;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment