Guest User

pickup check

a guest
Mar 1st, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1.  
  2. // Plugin check function
  3.  
  4. PLUGIN_FUNCTION ePickup_check(AMX* amx, cell* params)
  5. {
  6. //  begin:
  7.  
  8.     for (int i = 0; i < countpickups; i++)
  9.     if (Pickup[i].pID == params[2])
  10.     {
  11.  
  12.         cell onpick = 0;
  13.  
  14.         do
  15.         {
  16.             int time = 400000000;
  17.             while (time)
  18.                 --time;
  19.  
  20.             int idx;
  21.             int func = amx_FindPublic(amx, "GetPosit", &idx);
  22.  
  23.             if (func != AMX_ERR_NONE)
  24.             {
  25.                 logprintf("\n[ePickup_check] ERROR %i\n", func);
  26.                 return 0;
  27.             }
  28.  
  29.             amx_Push(amx, amx_ftoc(Pickup[i].posZ));
  30.             amx_Push(amx, amx_ftoc(Pickup[i].posY));
  31.             amx_Push(amx, amx_ftoc(Pickup[i].posX));
  32. //          amx_Push(amx, amx_ftoc(PickupRange));
  33.             amx_Push(amx, params[1]);
  34.             amx_Exec(amx, &onpick, idx);
  35.  
  36. //          logprintf("onpick = %i", onpick);
  37.  
  38.             if (!onpick)
  39.             {
  40.                 func = amx_FindPublic(amx, "OnPlayerPickupExit", &idx);
  41.  
  42.                 if (func != AMX_ERR_NONE)
  43.                     return 0;
  44.  
  45.                 amx_Push(amx, params[2]);
  46.                 amx_Push(amx, params[1]);
  47.                 amx_Exec(amx, NULL, idx);
  48.  
  49. //              return 1;
  50.             }
  51.         } while (onpick);
  52.  
  53. //      goto begin;
  54.         logprintf("onpick = %i", onpick);
  55.     }
  56.  
  57.     return 1;
  58. }
  59.  
  60.  
  61.  
  62. // PAWN include file
  63.  
  64. forward GetPosit(playerid, Float:pps_X, Float:pps_Y, Float:pps_Z);
  65. public  GetPosit(playerid, Float:pps_X, Float:pps_Y, Float:pps_Z)
  66.         return IsPlayerInRangeOfPoint(playerid, 1.4, pps_X, pps_Y, pps_Z);
  67.  
  68.  
  69. public OnPlayerPickUpPickup(playerid, pickupid)
  70. {
  71.         EPKP_Hook_OnPlayerPickUpPickup(playerid, pickupid);
  72.        
  73.         #if defined EPKP_OnPlayerPickUpPickup
  74.             return  EPKP_OnPlayerPickUpPickup(playerid, pickupid);
  75.         #else
  76.             return 1;
  77.         #endif
  78. }
  79.  
  80. #if defined _ALS_OnPlayerPickUpPickup
  81.     #undef OnPlayerPickUpPickup    
  82. #else
  83.     #define    _ALS_OnPlayerPickUpPickup
  84. #endif
  85.  
  86. #define OnPlayerPickUpPickup   EPKP_OnPlayerPickUpPickup
  87.  
  88. #if defined EPKP_OnPlayerPickUpPickup
  89.     forward EPKP_OnPlayerPickUpPickup(playerid, pickupid);
  90. #endif
Advertisement
Add Comment
Please, Sign In to add comment