Skymagnum

Untitled

May 19th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. function onKill(cid, target)
  2.  
  3.     local MONSTERS = {
  4.         ["Rotworn"] = {storage = 38290, check = 30000, needKills = 100, rewards = {2160, 1}},
  5.         ["Dragon"] = {storage = 38291, check = 30001, needKills = 250, rewards = {2160, 25}}
  6.     }
  7.    
  8. local name = getCreatureName(target)
  9.  
  10.     local TB = MONSTERS[name]
  11.     local STOR = getPlayerStorageValue(cid, TB.storage) < 0 and 0 or getPlayerStorageValue(cid, TB.storage)
  12.  
  13.     if TB then
  14.         if isMonster(target) then
  15.             if STOR < TB.needKills then
  16.                 setPlayerStorageValue(cid, TB.storage, STOR + 1)
  17.                 doPlayerSendTextMessage(cid, 27, name .. "[" .. STOR .. "/" .. TB.needKills .. "]")
  18.             else
  19.                 if getPlayerStorageValue(cid, TB.check) < 1 then
  20.                     doPlayerSendTextMessage(cid, 28, name .. " task completed.")
  21.                     doPlayerAddItem(cid, TB.rewards[1], TB.rewards[2])
  22.                     setPlayerStorageValue(cid, TB.check, 1)
  23.                 end
  24.             end
  25.         end
  26.     end
  27.  
  28.     return true
  29. end
Advertisement
Add Comment
Please, Sign In to add comment