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

Npc ungreet player

Massen

Masserv RPG
Joined
Jul 23, 2007
Messages
324
Reaction score
1
Location
Sweden
Hello, Im currently creating a script (assassin outfit) and if the player don't have any beer whine or rum when greeting him he should simply ungreet the player.

I tested this function as it exists in "npchandler.lua"

NpcHandler:unGreet(cid)

Yet does noting?

Here is my current greet code for removing whine beer and rum + answearing with a custom message if the player doesn't have the above items.

Lua:
function greetCallback(cid)
    if doPlayerRemoveItem(cid, 2012, 1, 3) or doPlayerRemoveItem(cid, 2013, 1, 15) or doPlayerRemoveItem(cid, 5553, 1, 27) then

        npcHandler:setMessage(MESSAGE_GREET, "Hey t-there, you look like someone who enjoys a good booze.")
        return true
    else
        npcHandler:setMessage(MESSAGE_GREET, "I wont talk to <Hicks> such teetotaller... bring me some booze!")
		NpcHandler:unGreet(cid)
        return true
    end
end

He doesn't "ungreet" the player, and no error.

Anyone know how to do this?


cheers

//Massen
 
Simply use return false.
Lua:
function greetCallback(cid)
	if doPlayerRemoveItem(cid, 2012, 1, 3) or doPlayerRemoveItem(cid, 2013, 1, 15) or doPlayerRemoveItem(cid, 5553, 1, 27) then
		npcHandler:setMessage(MESSAGE_GREET, "Hey t-there, you look like someone who enjoys a good booze.")
		return true
	else
		npcHandler:say("Oh, two t-trolls. Hellooo, wittle twolls. <hicks>", cid)
		return false
	end
end
BTW, Vescu actually checks if player is drunk in real tibia.
 
Oh xD gotta fix it then :) thanks for the reply. I'v never really understood what return does :p i will try to find a tutorial explaining return :). I Will continue working om this script after christmas.

Cheers!

/Massen
 
I just tested it, and he wont reply at all if you are not drunk? =p any easy way to solve that while still ending the conversation?

Cheers

/Massen
 
Back
Top