BigETI

Problem *FIX*

May 27th, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.64 KB | None | 0 0
  1. //Use DestroyPickupEx if you want to destroy a pickup!
  2.  
  3. //News
  4. new Float:PickupPos[MAX_PICKUPS][3], Pickups = 0, outsidefront, outsideback, insideback, insidefront;
  5.  
  6. //Forward
  7. forward Check();
  8.  
  9. //Stocks
  10. stock CreatePickupEx(model, type, Float:X, Float:Y, Float:Z, Virtualworld)
  11. {
  12.     new pickupid = CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld);
  13.     Pickups++;
  14.     PickupPos[pickupid][0] = X;
  15.     PickupPos[pickupid][1] = Y;
  16.     PickupPos[pickupid][2] = Z;
  17.     return pickupid;
  18. }
  19.  
  20. stock DestroyPickupEx(pickup)
  21. {
  22.     DestroyPickup(pickup);
  23.     Pickups--;
  24.     for(new i = 0; i < 3; i++) PickupPos[pickupid][i] = 0.0;
  25. }
  26.  
  27. //Publics
  28. public Check()
  29. {
  30.     for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  31.     {
  32.         if(IsPlayerConnected(playerid))
  33.         {
  34.             new bool:pickupcheck = false;
  35.             for(new i = 0; i < Pickups; i++) if(IsPlayerInRangeOfPoint(playerid, 4.0, PickupPos[i][0], PickupPos[i][1], PickupPos[2])) pickupcheck = true;
  36.             if(!pickupcheck) SetPVarInt(playerid, "PickupID", -1);
  37.         }
  38.     }
  39. }
  40.  
  41. Public OnGameModeInit()
  42. {
  43.     //Pickups
  44.     outsidefront = CreatePickupEx(1318,23,2131.8494,-1151.0961,24.0855,-1);
  45.     outsideback = CreatePickupEx(1318,23,2124.0605,-1169.6489,24.1428,-1);
  46.     insideback = CreatePickupEx(1318,23,2128.6238,-1165.9609,13.7360,-1);
  47.     insidefront = CreatePickupEx(1318,23,2130.0591, -1155.0420, 13.7360,-1);
  48.     SetTimer("Check", 500, true);
  49. }
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53.     SetPVarInt(playerid, "PickupID", -1);
  54.     return 1;
  55. }
  56.  
  57. public OnPlayerPickUpPickup(playerid, pickupid)
  58. {
  59.     if(pickupid == outsidefront || pickupid == outsideback || pickupid == insidefront || pickupid == insideback) SetPVarInt(playerid, "PickupID", pickupid);
  60.     return 1;
  61. }
  62.  
  63. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  64. {
  65.     if((newkeys & KEY_SECONDARY_ATTACK) &&! (oldkeys & KEY_SECONDARY_ATTACK))
  66.     {
  67.         if(GetPVarInt(playerid, "PickupID") == outsidefront)
  68.         {
  69.             SetPlayerInterior(playerid, 1);
  70.             SetPlayerPos(playerid, 2130.0591, -1155.0420, 13.7360);
  71.             SetPVarInt(playerid, "PickupID", -1);
  72.         }
  73.         else if(GetPVarInt(playerid, "PickupID") == outsideback)
  74.         {
  75.             SetPlayerInterior(playerid, 1);
  76.             SetPlayerPos(playerid, 2128.6238, -1165.9609, 13.7360);
  77.             SetPVarInt(playerid, "PickupID", -1);
  78.         }
  79.         else if(GetPVarInt(playerid, "PickupID") == insidefront)
  80.         {
  81.             SetPlayerInterior(playerid, 0);
  82.             SetPlayerPos(playerid, 2131.8494, -1151.0961, 24.0855);
  83.             SetPVarInt(playerid, "PickupID", -1);
  84.         }
  85.         else if(GetPVarInt(playerid, "PickupID") == insideback)
  86.         {
  87.             SetPlayerInterior(playerid, 0);
  88.             SetPlayerPos(playerid, 2124.0605, -1169.6489, 24.1428);
  89.             SetPVarInt(playerid, "PickupID", -1);
  90.         }
  91.     }
  92.     return 1;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment