• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Npc error

Dyker

New Member
Joined
Sep 12, 2008
Messages
97
Reaction score
1
Code:
[10/09/2011 15:57:52] [Error - Npc interface] 
[10/09/2011 15:57:52] data/npc/scripts/vocation.lua:onCreatureSay
[10/09/2011 15:57:52] Description: 
[10/09/2011 15:57:52] (internalGetPlayerInfo) Player not found when requesting player info #6

When someone talks to this npc when he ask for somethink appears that message on the console and he don't say nothing. He says the greetings and appears when i summon, but when I ask for the promotion he doesn't answer

Here the NPC script

Code:
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)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	local first = {
		archer = 3
	}
	local second = {
		sniper = 6,
		shooter = 7
	}
	local thirdSniper = {
		sharpSniper = 13,
		elementalSniper = 12
	}
	local thirdShooter = {
		fastShooter = 27,
		hunter = 26
	}
	local final = {
		masterArcher = 25, 
		royalHunter = 24
	}
 
-- end of config, start of script	
	if(msgcontains(msg, 'first promotion') and getPlayerVocation(cid, first.archer)) == true then
			npcHandler:say("Would you like to be promoted to {sniper} or {shooter}?", cid)
			talkState[talkUser] = 1
		elseif(msgcontains(msg, 'shooter') and talkState[talkUser] == 1) then
			if getPlayerVocation(cid, first.archer) == true then
			npcHandler:say("Would you like to be promoted to {shooter}", cid)
			talkState[talkUser] = 2
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			doPlayerSetVocation(cid, second.shooter) 
			npcHandler:say("You have been promoted to {shooter}", cid)
	elseif(msgcontains(msg, 'sniper') and talkState[talkUser] == 1) then
			npcHandler:say("Would you like to be promoted to {sniper}", cid)
			talkState[talkUser] = 3
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
			doPlayerSetVocation(cid, second.sniper) 
			npcHandler:say("You have been promoted to {sniper}", cid)
	elseif(msgcontains(msg, 'second promotion') and getPlayerVocation(cid, second.sniper)) == true then
	npcHandler:say("Would you like to be promoted to {Sharp sniper} or {elemental sniper}", cid)
			talkState[talkUser] = 4
	elseif(msgcontains(msg, 'sharp sniper') and talkState[talkUser] == 4) then
			if getPlayerVocation(cid, second.sniper) == true then
			npcHandler:say("Would you like to be promoted to {Sharp sniper}", cid)
			talkState[talkUser] = 5
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then
			doPlayerSetVocation(cid, thirdSniper.sharpSniper) 
	elseif(msgcontains(msg, 'elemental sniper') and talkState[talkUser] == 4) then
			if getPlayerVocation(cid, second.sniper) == true then
			npcHandler:say("Would you like to be promoted to {Elemental sniper}", cid)
			talkState[talkUser] = 6
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then
			doPlayerSetVocation(cid, thirdSniper.elementalSniper)
	elseif(msgcontains(msg, 'second promotion') and getPlayerVocation(cid, second.shooter)) == true then
	npcHandler:say("Would you like to be promoted to {Fast shooter} or {hunter}", cid)
			talkState[talkUser] = 7
	elseif(msgcontains(msg, 'fast shooter') and talkState[talkUser] == 7) then
			if getPlayerVocation(cid, second.shooter) == true then
			npcHandler:say("Would you like to be promoted to {fast shooter}", cid)
			talkState[talkUser] = 8
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8) then
			doPlayerSetVocation(cid, thirdShooter.fastShooter) 
	elseif(msgcontains(msg, 'hunter') and talkState[talkUser] == 7) then
			if getPlayerVocation(cid, second.shooter) == true then
			npcHandler:say("Would you like to be promoted to {hunter}", cid)
			talkState[talkUser] = 9
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then
			doPlayerSetVocation(cid, thirdShooter.hunter)
	elseif(msgcontains(msg, 'third promotion') and getPlayerVocation(cid, thirdShooter.fastShooter) or getPlayerVocation(cid, thirdShooter.hunter)) == true then
		npcHandler:say("Would you like to be promoted to {Master archer}", cid)
		talkState[talkUser] = 10
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 10) then
			doPlayerSetVocation(cid, final.masterArcher) 
	elseif(msgcontains(msg, 'third promotion') and getPlayerVocation(cid, thirdSniper.sharpSniper) or getPlayerVocation(cid, thirdSniper.elementalSniper)) == true then
		npcHandler:say("Would you like to be promoted to {Royal hunter}", cid)
		talkState[talkUser] = 11
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 11) then
			doPlayerSetVocation(cid, final.royalHunter) 
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	end
	end
	end
	end
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
getPlayerVocation(cid, first.archer) -> getPlayerVocation(cid) == first.archer

etc, do it for the others aswell
 
I have changed by this and still don't work

Code:
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)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	local first = {
		archer = 3
	}
	local second = {
		sniper = 6,
		shooter = 7
	}
	local thirdSniper = {
		sharpSniper = 13,
		elementalSniper = 12
	}
	local thirdShooter = {
		fastShooter = 27,
		hunter = 26
	}
	local final = {
		masterArcher = 25, 
		royalHunter = 24
	}
 
-- end of config, start of script	
	if msgcontains(msg, 'first promotion') and (getPlayerVocation(cid) == first.archer) == true then
			npcHandler:say("Would you like to be promoted to {sniper} or {shooter}?", cid)
			talkState[talkUser] = 1
		elseif(msgcontains(msg, 'shooter') and talkState[talkUser] == 1) then
			if (getPlayerVocation(cid) == first.archer) == true then
			npcHandler:say("Would you like to be promoted to {shooter}", cid)
			talkState[talkUser] = 2
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			doPlayerSetVocation(cid, second.shooter)
			npcHandler:say("You have been promoted to {shooter}", cid)
	elseif(msgcontains(msg, 'sniper') and talkState[talkUser] == 1) then
			npcHandler:say("Would you like to be promoted to {sniper}", cid)
			talkState[talkUser] = 3
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
			doPlayerSetVocation(cid, second.sniper)
			npcHandler:say("You have been promoted to {sniper}", cid)
	elseif msgcontains(msg, 'second promotion') and (getPlayerVocation(cid) == second.sniper) == true then
	npcHandler:say("Would you like to be promoted to {Sharp sniper} or {elemental sniper}", cid)
			talkState[talkUser] = 4
	elseif(msgcontains(msg, 'sharp sniper') and talkState[talkUser] == 4) then
			if (getPlayerVocation(cid) == second.sniper) == true then
			npcHandler:say("Would you like to be promoted to {Sharp sniper}", cid)
			talkState[talkUser] = 5
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then
			doPlayerSetVocation(cid, thirdSniper.sharpSniper) 
	elseif(msgcontains(msg, 'elemental sniper') and talkState[talkUser] == 4) then
			if (getPlayerVocation(cid) == second.sniper) == true then
			npcHandler:say("Would you like to be promoted to {Elemental sniper}", cid)
			talkState[talkUser] = 6
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then
			doPlayerSetVocation(cid, thirdSniper.elementalSniper)
	elseif msgcontains(msg, 'second promotion') and (getPlayerVocation(cid) == second.shooter) == true then
	npcHandler:say("Would you like to be promoted to {Fast shooter} or {hunter}", cid)
			talkState[talkUser] = 7
	elseif(msgcontains(msg, 'fast shooter') and talkState[talkUser] == 7) then
			if (getPlayerVocation(cid) == second.shooter) == true then
			npcHandler:say("Would you like to be promoted to {fast shooter}", cid)
			talkState[talkUser] = 8
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8) then
			doPlayerSetVocation(cid, thirdShooter.fastShooter)
	elseif(msgcontains(msg, 'hunter') and talkState[talkUser] == 7) then
			if (getPlayerVocation(cid) == second.shooter) == true then
			npcHandler:say("Would you like to be promoted to {hunter}", cid)
			talkState[talkUser] = 9
			elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then
			doPlayerSetVocation(cid, thirdShooter.hunter)
	elseif msgcontains(msg, 'third promotion') and (getPlayerVocation(cid) == thirdShooter.fastShooter) or (getPlayerVocation(cid)  == thirdShooter.hunter) == true then
		npcHandler:say("Would you like to be promoted to {Master archer}", cid)
		talkState[talkUser] = 10
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 10) then
			doPlayerSetVocation(cid, final.masterArcher)
	elseif msgcontains(msg, 'third promotion') and (getPlayerVocation(cid) == thirdSniper.sharpSniper) or (getPlayerVocation(cid) == thirdSniper.elementalSniper) == true then
		npcHandler:say("Would you like to be promoted to {Royal hunter}", cid)
		talkState[talkUser] = 11
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 11) then
			doPlayerSetVocation(cid, final.royalHunter) 
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	end
	end
	end
	end
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

But now don't appear any error on console, he don't answer
 
Last edited:
Back
Top