What isnt working is doPlayerSetVocation(cid, 8)
Lua:
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 getplayervoc = getPlayerVocation(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'elite knight') then
if getPlayerLevel(cid) >= 1 and getplayervoc == 1 then
selfSay('Do you want to promote yourself to an Elite knight for 100000 gold?', cid)
else
selfSay('Your not an knight.', cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if getPlayerLevel(cid) >= 1 and getplayervoc == 2 then
doPlayerSetVocation(cid, 8)
selfSay('You are now promoted to an Elite knight.', cid)
talkState[talkUser] = 0
else
selfSay('gtfo', cid)
end
elseif msgcontains(msg, 'Royal paladin') then
if getPlayerLevel(cid) >= 1 and getplayervoc == 3 then
selfSay('Do you want to promote yourself to an royal paladin for 100000 gold?', cid)
else
selfSay('You need to be level 1000.', cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if getPlayerLevel(cid) >= 1 and getplayervoc == 3 then
doPlayerSetVocation(cid, 12)
selfSay('You are now promoted to an royal paladin.', cid)
talkState[talkUser] = 0
else
selfSay('gtfo', cid)
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())