Phemus
Member
- Joined
- Jun 16, 2012
- Messages
- 150
- Solutions
- 2
- Reaction score
- 13
Hi! I have a problem... I have a npc script that when you give to him 100 white pearls and 100 black pearls it have to give you a storage value. But my problem is that when you give to him 100 white pearls and like 50 black pearls, it removes you the white pearls and leave you with the black pearls. It is supposed that he only needs to say, "Do not try to deceive me." and leave you with the pearls.
Here is the script:
I hope that you can understand my problem and somebody could help and sorry for my bad English.
Here is the script:
LUA:
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
if(msgcontains(msg, 'panda')) then
selfSay('To have the panda outfit you need 100 white pearls and 100 black pearls, when you come back tell me about the {outfit}.', cid)
talkState[talkUser] = 1
elseif (msgcontains(msg, 'outfit')) then
if (getPlayerStorageValue(cid,12703) >= 1) then
selfSay('already have this outfit, I\'m sorry.', cid)
else
if (doPlayerRemoveItem(cid, 2143, 100) == TRUE) and (doPlayerRemoveItem(cid, 2144, 100) == TRUE) then
setPlayerStorageValue(cid,12703,1)
doSendMagicEffect(getCreaturePosition(cid), 13)
selfSay('I thank you, thank you very much, is not much but take this as thanks.', cid)
else
selfSay('Do not try to deceive me.', cid)
end
end
return true
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I hope that you can understand my problem and somebody could help and sorry for my bad English.
Last edited: