Someone can help me???
when a lvl < 20 says promotion, the npc answer : Do you want to be promoted for 20000 gols coins? ignoring the player level! Whats wrong??
thanks
;*
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local Topic = {}
local voc = getPlayerVocation(cid)
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 doNPCTalkALot(msgs,interval)
local e={}
local ret={}
if interval==nil then interval=3000 end --3 seconds is default time between messages
for aux=1,table.getn(msgs) do
e[aux]={}
doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
table.insert(ret,e[aux])
end
return(ret)
end
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, 'hail') or msgcontains(msg, 'hello') or msgcontains(msg, 'salutations')) and msgcontains(msg, 'queen') and (not npcHandler:isFocused(cid)) then
npcHandler:say('I greet thee, my loyal subject.', cid, TRUE)
npcHandler:addFocus(cid)
Topic[cid] = 0
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local namee = getPlayerName(cid)
if(msgcontains(msg, 'promotion') or msgcontains(msg, 'Promotion')) then
if doPlayerRemoveMoney(cid, 20000) == FALSE then
selfSay('You don\'t have enough gold coins.',cid)
elseif getPlayerVocation(cid) > 4 then
selfSay('You are already promoted.',cid)
elseif getPlayerLevel(cid) <= 19 then
selfSay('You need at least level 20 to get promoted.',cid)
elseif isPremium(cid) == FALSE then
selfSay('You need premium account to get promoted.',cid)
else
selfSay('Do you want to be promoted for 20000 gols coins?',cid)
Topic[cid] = 2
end
elseif(msgcontains(msg, 'yes') or msgcontains(msg, 'Yes') and Topic[cid] == 2) then
selfSay('Now you are promoted!',cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
when a lvl < 20 says promotion, the npc answer : Do you want to be promoted for 20000 gols coins? ignoring the player level! Whats wrong??
thanks
;*