skydangerous

Untitled

Nov 16th, 2011
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.15 KB | None | 0 0
  1. local sky = {
  2. amount = 100,
  3. looktype = 123,
  4. itemid = 1234,
  5. count = 10
  6. }
  7.  
  8. local keywordHandler = KeywordHandler:new()
  9. local npcHandler = NpcHandler:new(keywordHandler)
  10. NpcSystem.parseParameters(npcHandler)
  11. local talkState = {}
  12.  
  13. function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
  14. function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
  15. function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
  16. function onThink()                                      npcHandler:onThink()                                    end
  17.  
  18. function creatureSayCallback(cid, type, msg)
  19.         if(not npcHandler:isFocused(cid)) then
  20.                 return false
  21.         end
  22.  
  23.         local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  24.         local amount = 100 -- amount of gold
  25.         local looktype = 123 -- number of looktype
  26.         local itemid = 1234 -- itemid to remove
  27.         local count = 10 -- amount of itemid(^)
  28.         local k = getPlayerPromotionLevel(cid)
  29.         if msgcontains(msg, 'promotion') or msgcontains (msg, 'test') then
  30.                        if k ~= 1 then
  31.                                if getPlayerItemCount(cid, itemid) >= count and doPlayerRemoveMoney(cid, amount) then
  32.                                    doPlayerSetPromotionLevel(cid, 1)
  33.                                    selfSay('you have been promoted?', cid)
  34.                                    doCreatureChangeOutfit(cid,{lookType = looktype})  
  35.                                 talkState[talkUser] = 1
  36.                         else
  37.                                 selfSay('you need "..amount.." gold coin and "..count.." of "..getItemNameById(itemid).." to be promoted!', cid)
  38.                         end
  39.                         else
  40.                                   selfSay('you already promoted!', cid)
  41.                         end
  42.                 end
  43.     return true
  44. end
  45.    
  46.  
  47. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  48. npcHandler:addModule(FocusModule:new())
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment