beeki

Donator by Vodkart

May 30th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. local talkState = {}
  5. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  6. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  7. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  8. function onThink() npcHandler:onThink() end
  9. function creatureSayCallback(cid, type, msg)
  10. if(not npcHandler:isFocused(cid)) then
  11. return false
  12. end
  13. local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
  14. -- ["nome do item"] = {Qntos pontos vao custar, id do item}
  15. local t = {
  16.           ["boots of haste"] = {15, 2195}, --
  17.           ["demon helmet"] = {25, 2493},
  18.           ["frozen starlight"] = {30, 2361},
  19.           ["royal crossbow"] = {20, 8851},
  20.           ["solar axe"] = {30, 8925},
  21.           ["soft boots"] = {50, 2640},
  22.           ["demon armor"] = {100, 2494},
  23.           ["firewalker boots"] = {50, 9932},
  24.           ["magic plate armor"] = {70, 2472},
  25.           ["flame blade"] = {100, 8931}
  26.           }
  27. if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
  28. local str = ""
  29. str = str .. "Eu vendo estes items: "
  30. for name, pos in pairs(t) do
  31. str = str.." {"..name.."} = "..pos[1].." Points/"
  32. end
  33. str = str .. "."
  34. npcHandler:say(str, cid)
  35. elseif t[msg] then
  36.             if (doAccountRemovePoints(cid, t[msg][1]) == TRUE) then
  37.                     doPlayerAddItem(cid,t[msg][2],1)
  38.                     npcHandler:say("Aqui está seu ".. getItemNameById(t[msg][2]) .."!", cid)
  39.             else
  40.                     npcHandler:say("você não tem "..t[msg][1].." Points", cid)
  41.             end
  42. end
  43. return TRUE
  44. end
  45. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  46. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment