Advertisement
Rochet2

Untitled

Jan 2nd, 2013
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. -- by Black Wolf of blackwolfsden aka slp13at420 of ac-web.org
  2. -- custom item drop for creature 3100
  3. -- when npc dies this script will act as auto looting
  4. -- generates a random number between 1 n 25 then applies to variable a
  5. -- adds item 44209 x a
  6. -- adds to mg column in db +3 mg
  7.  
  8. local NPCID = 3100
  9.  
  10. local function reward(player)
  11.     player:AddItem(44209, math.random(1, 25))
  12.     WorldDBQuery("UPDATE logon.accounts SET `mg` = `mg` + '3' WHERE `login` = '"..player:GetAccountName().."' LIMIT 1; ")
  13.     player:SendBroadcastMessage("+3 mg earned")
  14. end
  15.  
  16. local function Mottledboar_Unit_EVENT_ON_DIED(pUnit, event, player)
  17.     if(player:IsInGroup()) then
  18.         for _, v in pairs(player:GetGroupPlayers()) do
  19.             if(v and v:IsInWorld()) then
  20.                 reward(v)
  21.             end
  22.         end
  23.     else -- I assume GetGroupPlayers includes the killer also
  24.         reward(player)
  25.     end
  26. end
  27.  
  28. RegisterUnitEvent(NPCID, 4, Mottledboar_Unit_EVENT_ON_DIED)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement