Advertisement
Guest User

KANiS

a guest
Aug 9th, 2008
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.67 KB | None | 0 0
  1. new Float:PickupIDs[400][3];
  2. #define FIX_PICKUPS if(!IsPickedUp(playerid,pickupid)) pickupid = GetPickupNearPlayer(playerid,5.0);
  3.  
  4. stock CreatePickupA(model,type,Float:x,Float:y,Float:z)
  5. {
  6.     new tmp;
  7.     tmp = CreatePickup(model,type,Float:x,Float:y,Float:z);
  8.     PickupIDs[tmp][0]=x; PickupIDs[tmp][1]=y; PickupIDs[tmp][2]=z;
  9.     return tmp;
  10. }
  11.  
  12. stock IsPickedUp(playerid,pickupid)
  13. {
  14.     if(!PlayerToPointM(5,playerid,PickupIDs[pickupid][0],PickupIDs[pickupid][1],PickupIDs[pickupid][2])) return 0;
  15.     return 1;
  16. }
  17.    
  18.  
  19. stock GetPickupNearPlayer(playerid,Float:radi) //Half Andre's function
  20. {
  21.     new Float:oldposx, Float:oldposy, Float:oldposz;
  22.     GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  23.  
  24.     for(new npickup=0; npickup<400; npickup++)
  25.     {      
  26.         new Float:tempposx, Float:tempposy, Float:tempposz;
  27.         tempposx = (oldposx -PickupIDs[npickup][0]);
  28.         tempposy = (oldposy -PickupIDs[npickup][1]);
  29.         tempposz = (oldposz -PickupIDs[npickup][2]);
  30.  
  31.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  32.         {
  33.             return npickup;
  34.         }
  35.     }
  36.     return -1;
  37. }
  38.    
  39. stock PlayerToPointM(Float:radi, playerid, Float:x, Float:y, Float:z) //By Andre, thanks.
  40. {
  41.     if(IsPlayerConnected(playerid))
  42.     {
  43.         new Float:oldposx, Float:oldposy, Float:oldposz;
  44.         new Float:tempposx, Float:tempposy, Float:tempposz;
  45.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  46.         tempposx = (oldposx -x);
  47.         tempposy = (oldposy -y);
  48.         tempposz = (oldposz -z);
  49.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  50.         {
  51.             return 1;
  52.         }
  53.     }
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement