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

Nesaj

New Member
Joined
Apr 10, 2008
Messages
126
Reaction score
0
Hello, i need an addon npc that sell all addons 1 per 1, like this one.

Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Até mais.')
          focus = 0
          talk_start = 0
  	end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
  	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
  	msg = string.lower(msg)

  	if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
  		selfSay('Ola ' .. getCreatureName(cid) .. '. Eu vendo todos os primeiros addons, males e female. Por 50k cada. E so me falar o nome do addon que voce quer. Exemplo: male knight.')
  		focus = cid
  		talk_start = os.clock()

	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Desculpe, ' .. getCreatureName(cid) .. '. Eu atendo você em um minuto.')

  	elseif focus == cid then
		talk_start = os.clock()

		--MALE--

		if msgcontains(msg, 'male citizen') and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 128, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male hunter')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 129, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male nobleman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 132, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male mage')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 130, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male norseman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 251, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male knight')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 131, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male nobleman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 132, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male summoner')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 133, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male warrior')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 134, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male barbarian')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 143, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male druid')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 144, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male wizard')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 145, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male oriental')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 146, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male pirate')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 151, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male assassin')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 152, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male beggar')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 153, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male shaman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 154, 1)
  		selfSay('Você já pode utilizar o addon.')

		----FEMALE---

		elseif msgcontains(msg, 'female citizen')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 136, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female hunter')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 137, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female summoner')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 138, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female knight')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 139, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female nobleman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 140, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female mage')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 141, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female warrior')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 142, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female barbarian')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 147, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female druid')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 148, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female wizard')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 149, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female oriental')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 150, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female pirate')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 155, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female assassin')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 156, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female beggar')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 157, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female shaman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 158, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female norseman')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 252, 1)
  		selfSay('Você já pode utilizar o addon.')

		----Novos 8.1---
		----MALE---

		elseif msgcontains(msg, 'male nightmare')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 268, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male jesker')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 273, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'male brotherhood')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 278, 1)
  		selfSay('Você já pode utilizar o addon.')

		----FEMALE---

		elseif msgcontains(msg, 'female nightmare')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 269, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female jesker')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 270, 1)
  		selfSay('Você já pode utilizar o addon.')

		elseif msgcontains(msg, 'female brotherhood')  and pay(cid,50000) then
		   	doPlayerAddAddon(cid, 279, 1)
  		selfSay('Você já pode utilizar o addon.')


  		elseif string.find(msg, '(%a*)bye(%a*)')  and getDistanceToCreature(cid) < 4 then
  			selfSay('Até mais, ' .. getCreatureName(cid) .. '.')
  			focus = 0
  			talk_start = 0

		elseif selfSay('Você não falou a roupa correta ou nao tem gps suficientes.') then
  			focus = 0
  			talk_start = 0

  		end
  	end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
	if focus > 0 then 
		x, y, z = creatureGetPosition(focus)
		myx, myy, myz = selfGetPosition()
		
		if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
			selfTurn(1)
		end 
		if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
			selfTurn(3)
		end
		if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
			selfTurn(2)
		end
		if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
			selfTurn(0)
		end
		if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
			selfTurn(2)
		end
		if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
			selfTurn(0)
		end
		if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
			selfTurn(3)
		end
		if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
			selfTurn(1)
		end
		if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
			selfTurn(2)
		end
		if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
			selfTurn(0)
		end
		if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
			selfTurn(3)
		end
		if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
			selfTurn(1)
		end
		if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
			selfTurn(2)
		end
		if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
			selfTurn(0)
		end
		if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
			selfTurn(3)
		end
		if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
			selfTurn(1)
		end
	end

  	if (os.clock() - talk_start) > 30 then
  		if focus > 0 then
  			selfSay('Até mais.')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Tchau.')
 			focus = 0
 		end
 	end
end

But i need it for the forgotten server... I already tried to make one using this lua function:
doPlayerAddOutfit(cid,looktype,addons)
But dont work. Can some one make it to me? =X
 
change every doPlayerAddAddon to doPlayerAddOutfit and add this at the bottom of thisnpc.lua or in global.lua:
Code:
function pay(cid, money)
    return doPlayerRemoveMoney(cid, money)
end
 
[10/08/2008 17:46:33] Lua Script Error: [Npc interface]
[10/08/2008 17:46:33] data/npc/scripts/addon.lua:eek:nCreatureSay

[10/08/2008 17:46:33] data/npc/lib/npc.lua:43: attempt to perform arithmetic on global 'cx' (a table value)
[10/08/2008 17:46:33] stack traceback:
[10/08/2008 17:46:33] data/npc/lib/npc.lua:43: in function 'getDistanceToCreature'
[10/08/2008 17:46:33] data/npc/scripts/addon.lua:39: in function <data/npc/scripts/addon.lua:36>
 
Back
Top