Guest User

[onKill] Kill Recompense

a guest
Mar 14th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. /data/creaturescripts/scripts/ crie um arquivo e renomeie para killRecompense:
  2. function onKill(cid, target)
  3.  
  4. local KILL = {
  5. ["Demon"] = {killed = 50, storage = 28382, rewards = {{2160, 10}, {2222, 2}, {3232, 2}}},
  6. ["Rat"] = {killed = 10, storage = 28383, rewards = {{2160, 10}, {2222, 2}, {3232, 2}}},
  7. }
  8.  
  9. local a = KILL[getCreatureName(target)]
  10.  
  11. if isMonster(target) then
  12.    if a then
  13.      if getPlayerStorageValue(cid, a.storage) >= a.killed then
  14.        for _, T in pairs(a.rewards) do
  15.          doPlayerAddItem(cid, T[1], T[2])
  16.           end
  17.             doPlayerSendTextMessage(cid, 27, "You win your recompense for kill " .. a.killed .. " " .. getCreatureName(target) .. ".")
  18.               setPlayerStorageValue(cid, a.storage, 0)
  19.                else
  20.                  setPlayerStorageValue(cid, a.storage, getPlayerStorageValue(cid, a.storage) + 1)
  21.                      doPlayerSendTextMessage(cid, 27, "Now you need kill only more " .. getPlayerStorageValue(cid, a.storage) - a.killed .. " " .. getCreatureName(target) .. ".")
  22.                  end
  23.               end
  24.           end
  25. return true
  26. end
  27.  
  28. data/creaturescripts/scripts/login.lua:
  29. registerCreatureEvent(cid, "killRec")
  30.  
  31. data/creaturescripts/creaturescripts.xml:
  32.     <event type="kill" name="killRec" event="script" value="killRecompense.lua"/>
Advertisement
Add Comment
Please, Sign In to add comment