Advertisement
Skymagnum

Untitled

May 9th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. --[[ Quest system
  2. Fácil configuração para você criar suas quest, muito simples
  3. Author : Skymagnum or Skyforever
  4. Contact : TibiaKing.com / Xtibia.com
  5.  
  6. ENJOY IT!
  7. ]]--
  8.  
  9. function CompleteQuest(player, configuration)
  10.  
  11.     if getPlayerStorageValue(player, configuration.storage) > 0 then
  12.         doSendMagicEffect(getThingPos(player), configuration.failEff)
  13.         return doPlayerSendTextMessage(cid, 25, "You already complete this quest.")
  14.     end
  15.  
  16.     local item = nil
  17.  
  18.     for _, T in pairs(configuration.items) do
  19.         if getPlayerFreeCap(player) < (getItemWeight(T[1]) * T[2]) then
  20.             item = doPlayerAddItem(player, T[1], T[2])
  21.             doSendMagicEffect(getThingPos(player), configuration.completeEff)
  22.         else
  23.             item = doCreateItemEx(T[1], T[2])
  24.             doPlayerSendMailByName(getCreatureName(player), item)
  25.             doSendMagicEffect(getThingPos(player), configuration.depotEff)
  26.             doPlayerSendTextMessage(cid, 22, "You don't have capacity, item send to depot.")
  27.         end
  28.     end
  29. end
  30.  
  31. In your quest script you take it:
  32. function onUse(cid, item, fromPosition, itemEx, toPosition)
  33.  
  34.     return CompleteQuest(cid, config)
  35. end
  36.  
  37. where config is:
  38. local config = {
  39.     storage = 329302,
  40.     failEff = 9,
  41.     items = {{2160, 10}, {2159, 30}},
  42.     completeEff = 28,
  43.     depotEff = 30,
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement