Advertisement
Guest User

RandomSpawn.pwn

a guest
May 31st, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.77 KB | None | 0 0
  1. #include a_samp
  2. #include mapandreas // http://forum.sa-mp.com/showthread.php?t=275492
  3.  
  4. forward RandomSpawn(pid, freeze);
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     new time = gettime();
  9.     MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
  10.     printf("  RandomSpawn loaded - took %d seconds.", gettime() - time);
  11. }
  12.  
  13. public RandomSpawn(pid, freeze)
  14. {
  15.     if(freeze) TogglePlayerControllable(pid, 0);
  16.  
  17.     new
  18.         Float:pos[3],
  19.         x=random(4000)-2000,
  20.         y=random(4000)-2000,
  21.         Float:z;
  22.        
  23.     for(new a; a < 100; a++)
  24.     {
  25.         MapAndreas_FindZ_For2DCoord(x, y, z);
  26.  
  27.         if(z >= 5.0 && z < 30.0)
  28.         {
  29.             pos[0] = x;
  30.             pos[1] = y;
  31.             pos[2] = z;
  32.             SetPlayerPos(pid, x, y, z);
  33.             break;
  34.         }
  35.     }
  36.  
  37.     if(freeze) TogglePlayerControllable(pid, 1);
  38.     return 1;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement