• 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!

[Request] Addon Npc For Tfs 0.2.9

ragal

Member
Joined
Nov 29, 2007
Messages
735
Reaction score
19
Location
Germany - Berlin
I need that npc that i can buy all addons for 1 gp
but i dont know how to code this npc since im noob at lua ;p
plx help me out ok

~bumb~
that npc should be sell the 8.1 addons too :p
 
Last edited by a moderator:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not 

have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end

	if msgcontains(msg, 'first') then
	if isPremium(cid) == TRUE then
	npcHandler:say("Do you want to buy first addons for 1 gp?")
	talkState = 1
	else
	npcHandler:say("You need premium account.")
	talkState = 0
	end

	elseif msgcontains(msg, 'second') then
	if isPremium(cid) == TRUE then
	npcHandler:say("Do you want to buy second addons for 1 gp")
	talkState = 2
	else
	npcHandler:say("You need premium account.")
	talkState = 0
	end

	elseif msgcontains(msg, 'yes') and talkState == 1 then
	if doPlayerRemoveMoney(cid, 1) == 1 then
	npcHandler:say("Here you go.")
	doPlayerAddOutfit(cid, x , 1)
	doPlayerAddOutfit(cid, x , 1) -- copy this line and paste here as many times as there r outfits in x place write the 

number of outf.
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
	talkState = 0
	else
	npcHandler:say("You don\'t have enough money.")
	talkState = 0
	end

	elseif msgcontains(msg, 'yes') and talkState == 2 then
	if doPlayerRemoveMoney(cid, 1) == 1 then
	npcHandler:say("Here you go.")
	doPlayerAddOutfit(cid, x , 2)
	doPlayerAddOutfit(cid, x , 2) -- copy this line and paste here as many times as there r outfits in x place write the 

number of outf.
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
	talkState = 0
	else
	npcHandler:say("You don\'t have enough money.")
	talkState = 0
	end

return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
try this, didnt test.
 
Dear ragal, it seems you have posted your thread in the wrong section. Dont worry i have moved it, altought you are only allowed to bump an thread every 24H instead of 16 Min your posts have been merged, the next time it will result into an Infraction.

Here are some links that could help you.
Search Function here
Where u should post what here
All Released scripts here
 
Back
Top