kimokimo
Kimo
PHP:
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 vocationName = ''
if getPlayerVocation(cid) == 9-4 then
vocationName = 'white wizard'
elseif getPlayerVocation(cid) == 10-4 then
vocationName = 'holy Shaman'
elseif getPlayerVocation(cid) == 11-4 then
vocationName = 'deadly archer'
elseif getPlayerVocation(cid) == 12-4 then
vocationName = 'elite Berserker'
else
vocationName = 'You do not match any vocation'
end
if(msgcontains(msg, 'prize')) then
if getPlayerStorageValue(cid,20008) <= 0 then
selfSay('if you reach lvl 500 say {promotion} for all of your hard work.', cid)
talkState[talkUser] = 1
else
selfSay('Begone!.', cid)
doTeleportThing(cid,{x = 1000, y = 1000, z = 7},false)
end
elseif(msgcontains(msg, 'promotion') and talkState[talkUser] == 1) then
setPlayerPromotionLevel(cid, 2)
setPlayerStorageValue(cid, 20008, 1)
selfSay('You have shown to me that you have mastered each aspect of your vocation. From this point on you may call yourself a '..vocationName..', Ask me to {leave} when you are ready.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
can anyone make if player got lvl 500 or higher can get promotion from this npc