function NpcHandler:onWalkAway(cid)
if self:isFocused(cid) then
local callback = self:getCallback(CALLBACK_CREATURE_DISAPPEAR)
if callback == nil or callback() then
if self:processModuleCallback(CALLBACK_CREATURE_DISAPPEAR, cid) then
local msg = self:getMessage(MESSAGE_WALKAWAY)
local player = Player(cid)
local playerName = player and player:getName() or -1
local playerSex = player and player:getSex() or 0
local parseInfo = { [TAG_PLAYERNAME] = playerName }
local message = self:parseMessage(msg, parseInfo)
local msg_male = self:getMessage(MESSAGE_WALKAWAY_MALE)
local message_male = self:parseMessage(msg_male, parseInfo)
local msg_female = self:getMessage(MESSAGE_WALKAWAY_FEMALE)
local message_female = self:parseMessage(msg_female, parseInfo)
if message_female ~= message_male then
if playerSex == PLAYERSEX_FEMALE then
self:say(message_female, TALKTYPE_PRIVATE_NP, false, player, self:getPosition())
else
self:say(message_male, TALKTYPE_PRIVATE_NP, false, player, self:getPosition())
end
elseif message ~= "" then
self:say(message, TALKTYPE_PRIVATE_NP, false, player, self:getPosition())
end
self:resetNpc(cid)
self:releaseFocus(cid)
end
end
end
end