skydangerous

Untitled

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