rockbandcheeseman

OnWeaponPickup and OnWeaponDrop

Jul 17th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. weapons = {}
  2.  
  3. registertimer(10, "WeaponMonitor")
  4.  
  5. function WeaponMonitor(id, count)
  6.  
  7.     for player = 0,15 do
  8.         weapons[player] = weapons[player] or {}
  9.         local m_player = getplayer(player)
  10.         if m_player then
  11.             local objId = readdword(m_player, 0x34)
  12.             local m_object = getobject(objId)
  13.             if m_object then
  14.                 for i = 0,3 do
  15.                     local weapId = readdword(m_object, 0x2F8 + (i * 4))
  16.                     local m_weapon = getobject(weapId)
  17.                     if m_weapon then
  18.                         local mapId = readdword(m_weapon)
  19.                         if weapons[player][i] then
  20.                             if weapons[player][i].weapId ~= weapId then
  21.                                 OnWeaponDrop(player, weapons[player][i].weapId, i, weapons[player][i].mapId)
  22.                                 weapons[player][i] = {}
  23.                                 weapons[player][i].weapId = weapId
  24.                                 weapons[player][i].mapId = mapId
  25.                                 OnWeaponPickup(player, weapId, i, mapId)
  26.                             end
  27.                         else
  28.                             weapons[player][i] = {}
  29.                             weapons[player][i].weapId = weapId
  30.                             weapons[player][i].mapId = mapId
  31.                             OnWeaponPickup(player, weapId, i, mapId)
  32.                         end
  33.                     else
  34.                         if weapons[player][i] then
  35.                             OnWeaponDrop(player, weapons[player][i].weapId, i, weapons[player][i].mapId)
  36.                             weapons[player][i] = nil
  37.                         end
  38.                     end
  39.                 end
  40.             else
  41.                 for i = 0,3 do
  42.                     if weapons[player][i] then
  43.                         OnWeaponDrop(player, weapons[player][i].weapId, i, weapons[player][i].mapId)
  44.                         weapons[player][i] = nil
  45.                     end
  46.                 end
  47.             end
  48.         end
  49.     end
  50.    
  51.     return true
  52. end
  53.  
  54. function OnWeaponPickup(player, weapId, slot, mapId)
  55.  
  56.  
  57. end
  58.  
  59. function OnWeaponDrop(player, weapId, slot, mapId)
  60.  
  61.  
  62. end
Advertisement
Add Comment
Please, Sign In to add comment