• 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!

[custom npc error]

Dyker

New Member
Joined
Sep 12, 2008
Messages
97
Reaction score
1
Could someone correct this script? and why appears this error on console?

NPC script
Code:
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

CONSOLE ERROR

Code:
[13/09/2011 19:29:47] [Error - Npc interface] 
[13/09/2011 19:29:47] data/npc/scripts/vocations.lua:onCreatureSay
[13/09/2011 19:29:47] Description: 
[13/09/2011 19:29:47] (internalGetPlayerInfo) Player not found when requesting player info #6

It appears when I say the MSG like "first promotion"
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

npcHandler:addModule(FocusModule:new())

try this
 
apps srry xD this is not the script lol is this
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
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
 
npcHandler:addModule(FocusModule:new())

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


    if msgcontains(msg, 'first promotion') then
		if getPlayerVocation(cid, 3) == true then
		npcHandler:say('Yes, I can offer you two kind of promotions, which will you choose?', cid)
		talkState[talkUser] = 1
	if msgcontains(msg, 'sniper') then
		doPlayerSetVocation(cid, 5)
		npcHandler:say('Congratulations, you are now an sniper', cid)
		talkState[talkUser] = 1
	if msgcontains(msg, 'shooter') then
		doplayersetVocation(cid, 6)
		npcHandler:say('Congratulations, you are now a shooter', cid)
		        elseif getPlayerVocation(cid, 3) == false then
                npcHandler:say('Sorry I can`t promote you', cid)
                talkState[talkUser] = 2

            end
    return true
	end
	end
	end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
uhm shit i got error on another NPC. And I can't find the errors :S

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)
        if(not npcHandler:isFocused(cid)) then
        return false
    end

        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
        local storage = 4444
        local voc1 = 3
        local voc2 = 4

        if msgcontains(msg, 'quest') then
                selfSay("Do you want to {do} the quest or to {finish} it?", cid)
                talkState[talkUser] = 1
                if msgcontains(msg, 'do') then
                        selfSay("I need you to bring me a special code...", cid)
                        selfSay("Its hide on a special statue...", cid)
                if msgcontains(msg, 'finish') then
                        if getPlayerStorageValue(cid, storage) ~= 1 then
                                        selfSay("You dont have the code.", cid)
                        else
                                selfSay("You found the code!", cid)
                                selfSay("Now you can choose your new vocation, it can be {Heavy Warrior} or {Light Warrior}.", cid)
                                if msgcontains(msg, 'Heavy Warrior') then
                                        setPlayerVocation(cid, voc1)
                                elseif msgcontains(msg, 'Light Warrior') then
                                        setPlayerVocation(cid, voc2)
                                end
                        end
                end
    end 
        return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

When I say quest it works but when I say "do" or "finish" don't say nothing :s
 
Back
Top