• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[NPC Request] Addon Giver

Synergy

New Member
Joined
Nov 24, 2011
Messages
334
Reaction score
0
Greetings OTLand scripters, Can someone please make me this script:

You give it 100 pieces of an item
It gives you the first assassin addon

And please make it configurable for more npcs so i can copy & paste

Thanks in advance / Jayswag :]


PS. I got the latest TFS for 9.31
 
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 onPlayerEndTrade(cid)			npcHandler:onPlayerEndTrade(cid)			end
function onPlayerCloseChannel(cid)		npcHandler:onPlayerCloseChannel(cid)		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

	local item = 11111 -- need item
	local outfit = 111 -- give outfit
	
-- prize
	if doMessageCheck(msg, 'outfit') then
		selfSay('blabla outfit?', cid)
		talkState[talkUser] = 1
	elseif talkState[talkUser] == 1 and doMessageCheck(msg, 'yes') then
		if isPremium(cid) then
			if doPlayerRemoveItem(cid, item, 100) then
				if  not canPlayerWearOutfitId(cid, outfit, 1) then
					selfSay('Congratulations! Here, from now on you can wear our lovely potion belt as accessory.', cid)
					doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_RED)
					doPlayerAddOutfit(cid, outfit, 1)
				else
					selfSay('It seems you already have this addon, don\'t you try to mock me son!', cid)
				end
			else
				selfSay('You do not have required items.')
			end
		else
			selfSay('You have no premium acount!', cid)
		end
		talkState[talkUser] = 0

-- no
	elseif(doMessageCheck(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top