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
local PRO = {
[0] = {lvl=20,gold=20000}, -- Ex: promo 0 zero kina > elite kina
[1] = {lvl=50,gold=50000} -- Ex: promo 1 elite kina > new kina
}
function creatureSayCallback(cid, _, msg)
if(not npcHandler:isFocused(cid)) then return false end
local msg,pro = string.lower(msg),getPlayerPromotionLevel(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'promot'))then
if(getPlayerLevel(cid) >= PRO[pro].lvl)then
if(isPlayerPremiumCallback(cid) or not getBooleanFromString(getConfigValue('premiumForPromotion'))) then
npcHandler:say('Gostaria de ser promovido por '..PRO[pro].gold..' Gps?', cid)
talkState[talkUser] = 1
else
npcHandler:say('Desculpe, mas promotion é apenas para premmy accounts.', cid)
talkState[talkUser] = 0
end
else
npcHandler:say('Para ser promovido é preciso ter level '..PRO[pro].lvl..' ou mais e '..PRO[pro].gold..' moedas de ouro.', cid)
talkState[talkUser] = 0
elseif(talkState[talkUser] == 1)then
if(doPlayerRemoveMoney(cid, PRO[pro].gold))then
setPlayerPromotionLevel(cid,pro+1)
npcHandler:say('Acabo de promove-lo siga agora sua honra.',cid)
talkState[talkUser] = 0
npcHandler:resetNpc()
else
npcHandler:say('Desculpe, mas voce nao tem os '..PRO[pro].gold..' Gps. volte quando os tiver.',cid)
talkState[talkUser] = 0
npcHandler:resetNpc()
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
é só modificar