deejaydex
New Member
- Joined
- May 11, 2008
- Messages
- 15
- Reaction score
- 0
Hi everyone, I'm trying to make REAL npc Atrad selling Assassin Stars. He can sell you assassin stars now by a "buy" command (giving 100 assassin stars for 10k). But how to do that to may him sell them by a trade window?
P.S Now script is done to sell only to owners of Assassin Outfit, I want to leave it working like that, its important.
He must sell only by trade window to owners of assassin out.
HOW TO DO THAT?
There is my script what i have done.
P.S Now script is done to sell only to owners of Assassin Outfit, I want to leave it working like that, its important.
He must sell only by trade window to owners of assassin out.
HOW TO DO THAT?
There is my script what i have done.
Code:
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, 'assassin') or msgcontains(msg, 'star') then
if getPlayerStorageValue(cid,10023) == 1 then
selfSay('Pssst! I can sell you our mighty weapon! 100 Assassins Stars for 10 000 gps, simple say {buy}. And remember! You didnt saw me here!', cid)
else
selfSay('What are you talking about?! Assassin Stars? Whats that? I never heard that before...', cid)
end
elseif msgcontains(msg, 'buy') then
if getPlayerStorageValue(cid,10023) == -1 then
selfSay('yyy... What are you talking about?! Assassin Stars? Whats that? I never heard that before...', cid)
else
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddItem(cid, 7368,100)
selfSay('Here.', cid)
else
selfSay('Dont have money?! Get lost!', cid)
end
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())