habiba
New Member
I need help on NPCs in GREET_MESSAGE
So what i need is to use the function:
npcHandler:setMessage(MESSAGE_GREET, "Message here")
It work fine but i need to add getPlayerStorageValue to get other greet messages
depending on the storage value, How can i do this?
Script base:
Used Gesior script:
If someone can tell me the solution ill rep him
So what i need is to use the function:
npcHandler:setMessage(MESSAGE_GREET, "Message here")
It work fine but i need to add getPlayerStorageValue to get other greet messages
depending on the storage value, How can i do this?
Script base:
Used Gesior script:
PHP:
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)
talk_state[cid] = 0
npcHandler:onCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|. I'm banker.")
talk_state = {}
last_count = {}
last_name = {}
function creatureSayCallback(cid, type, msg)
orginal_msg = msg
msg = string.lower(msg)
if(not npcHandler:isFocused(cid)) then
talk_state[cid] = 0
return false
end
if talk_state[cid] == nil then
talk_state[cid] = 0
last_count[cid] = 0
last_name[cid] = ""
end
-- select action
if msgcontains(msg, 'change') and talk_state[cid] ~= 41 then
talk_state[cid] = 10
npcHandler:say('We exchange gold, platinum and crystal coins.', cid)
elseif msgcontains(msg, 'balance') and talk_state[cid] ~= 41 then
talk_state[cid] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If someone can tell me the solution ill rep him