I want the npc Atrad requiring only have the assassin's outfit, my script requires player with full assassin.
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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, 'assassin') or msgcontains(msg, 'star')) then
selfSay('You buy 100 assassin for 20000 gold coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerStorageValue(cid,10024) and getPlayerStorageValue(cid,10023) >= 1) then
if(doPlayerRemoveMoney(cid, 10000) == TRUE) then
doPlayerAddItem(cid, 7368, 100)
selfSay('Here you are.', cid)
else
selfSay('Sorry you do not have enough of money to buy Assassin Stars.', cid)
end
else
selfSay('I am sorry you do not have the assassin outfit.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Last edited: