Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sky = {
- amount = 100,
- looktype = 123,
- itemid = 1234,
- count = 10
- }
- local keywordHandler = KeywordHandler:new()
- local npcHandler = NpcHandler:new(keywordHandler)
- NpcSystem.parseParameters(npcHandler)
- local talkState = {}
- function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
- function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
- function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
- function onThink() npcHandler:onThink() end
- function creatureSayCallback(cid, type, msg)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- local amount = 100 -- amount of gold
- local looktype = 123 -- number of looktype
- local itemid = 1234 -- itemid to remove
- local count = 10 -- amount of itemid(^)
- local k = getPlayerPromotionLevel(cid)
- if msgcontains(msg, 'promotion') or msgcontains (msg, 'test') then
- if k ~= 1 then
- if getPlayerItemCount(cid, itemid) >= count and doPlayerRemoveMoney(cid, amount) then
- doPlayerSetPromotionLevel(cid, 1)
- selfSay('you have been promoted?', cid)
- doCreatureChangeOutfit(cid,{lookType = looktype})
- talkState[talkUser] = 1
- else
- selfSay('you need "..amount.." gold coin and "..count.." of "..getItemNameById(itemid).." to be promoted!', cid)
- end
- else
- selfSay('you already promoted!', cid)
- end
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment