• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Separated addons in Addon Doll

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Made by Bogart here.

Lua:
function onSay(cid, words, param) 
local femaleOutfits = { ["citizen"]={136}, ["hunter"]={137}, ["mage"]={138}, ["knight"]={139}, ["noblewoman"]={140}, ["summoner"]={141}, ["warrior"]={142}, ["barbarian"]={147}, ["druid"]={148}, ["wizard"]={149}, ["oriental"]={150}, ["pirate"]={155}, ["assassin"]={156}, ["beggar"]={157}, ["shaman"]={158}, ["norsewoman"]={252}, ["nightmare"]={269}, ["jester"]={270}, ["brotherhood"]={279}, ["demonhunter"]={288}, ["yalaharian"]={324}, ["warmaster"]={336}, ["wayfarer"]={366} } 
local maleOutfits = { ["citizen"]={128}, ["hunter"]={129}, ["mage"]={130}, ["knight"]={131}, ["nobleman"]={132},["summoner"]={133}, ["warrior"]={134}, ["barbarian"]={143}, ["druid"]={144}, ["wizard"]={145}, ["oriental"]={146}, ["pirate"]={151}, ["assassin"]={152}, ["beggar"]={153}, ["shaman"]={154}, ["norsewoman"]={251}, ["nightmare"]={268}, ["jester"]={273}, ["brotherhood"]={278}, ["demonhunter"]={289}, ["yalaharian"]={325}, ["warmaster"]={335}, ["wayfarer"]={367} } 
local msg = {"Command requires GOOD param!", "You dont have Addon Doll!", "Bad param!", "Full Addon Set sucesfully added!"} 
local x = string.explode(param, ",") 
	if(getPlayerItemCount(cid, 8982) > 0) then 
		if param ~= "" then 
			if maleOutfits[x[1]:lower()] and femaleOutfits[x[1]:lower()] then
				if (x[2] == '1' or x[2] == '2') then
					doPlayerRemoveItem(cid, 8982, 1) 
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4]) 
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) 
						if(getPlayerSex(cid) == 0)then 
							doPlayerAddOutfit(cid, femaleOutfits[x[1]:lower()][1], x[2]) 
						else 
							doPlayerAddOutfit(cid, maleOutfits[x[1]:lower()][1], x[2]) 
						end
				else
					doPlayerSendTextMessage(cid, 27, msg[3])
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3])
			end
		else 
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1]) 
		end 
	else 
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2]) 
	end
return true
end
 
Last edited:
i got this error when i use !addon knight or any outfit


[16:53:31.066] [Error - TalkAction Interface]
[16:53:31.068] data/talkactions/scripts/addondoll.lua:eek:nSay
[16:53:31.071] Description:
[16:53:31.073] data/talkactions/scripts/addondoll.lua:8: attempt to index field
'?' (a nil value)
[16:53:31.078] stack traceback:
[16:53:31.080] data/talkactions/scripts/addondoll.lua:8: in function <data/talk
actions/scripts/addondoll.lua:1>
 
Lua:
function onSay(cid, words, param) 
local femaleOutfits = { ["citizen"]={136}, ["hunter"]={137}, ["mage"]={138}, ["knight"]={139}, ["noblewoman"]={140}, ["summoner"]={141}, ["warrior"]={142}, ["barbarian"]={147}, ["druid"]={148}, ["wizard"]={149}, ["oriental"]={150}, ["pirate"]={155}, ["assassin"]={156}, ["beggar"]={157}, ["shaman"]={158}, ["norsewoman"]={252}, ["nightmare"]={269}, ["jester"]={270}, ["brotherhood"]={279}, ["demonhunter"]={288}, ["yalaharian"]={324}, ["warmaster"]={336} } 
local maleOutfits = { ["citizen"]={128}, ["hunter"]={129}, ["mage"]={130}, ["knight"]={131}, ["nobleman"]={132},["summoner"]={133}, ["warrior"]={134}, ["barbarian"]={143}, ["druid"]={144}, ["wizard"]={145}, ["oriental"]={146}, ["pirate"]={151}, ["assassin"]={152}, ["beggar"]={153}, ["shaman"]={154}, ["norsewoman"]={251}, ["nightmare"]={268}, ["jester"]={273}, ["brotherhood"]={278}, ["demonhunter"]={289}, ["yalaharian"]={325}, ["warmaster"]={335}, ["wayfarer"]={366} } 
local msg = {"Command requires GOOD param!", "You dont have Addon Doll!", "Bad param!", "Full Addon Set sucesfully added!"} 
local x = string.explode(param, ",") 
	if(getPlayerItemCount(cid, 8982) > 0) then 
		if param ~= "" then 
			if maleOutfits[x[1]:lower()] and femaleOutfits[x[1]:lower()] then
				if (x[2] == '1' or x[2] == '2') then
					doPlayerRemoveItem(cid, 8982, 1) 
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4]) 
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) 
						if(getPlayerSex(cid) == 0)then 
							doPlayerAddOutfit(cid, femaleOutfits[x[1]:lower()][1], x[2]) 
						else 
							doPlayerAddOutfit(cid, maleOutfits[x[1]:lower()][1], x[2]) 
						end
				else
					doPlayerSendTextMessage(cid, 27, msg[3])
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3])
			end
		else 
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1]) 
		end 
	else 
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2]) 
	end
return true
end
!addon knight, 1
 
Last edited:
Lua:
function onSay(cid, words, param) 
local femaleOutfits = { ["citizen"]={136}, ["hunter"]={137}, ["mage"]={138}, ["knight"]={139}, ["noblewoman"]={140}, ["summoner"]={141}, ["warrior"]={142}, ["barbarian"]={147}, ["druid"]={148}, ["wizard"]={149}, ["oriental"]={150}, ["pirate"]={155}, ["assassin"]={156}, ["beggar"]={157}, ["shaman"]={158}, ["norsewoman"]={252}, ["nightmare"]={269}, ["jester"]={270}, ["brotherhood"]={279}, ["demonhunter"]={288}, ["yalaharian"]={324}, ["warmaster"]={336} } 
local maleOutfits = { ["citizen"]={128}, ["hunter"]={129}, ["mage"]={130}, ["knight"]={131}, ["nobleman"]={132},["summoner"]={133}, ["warrior"]={134}, ["barbarian"]={143}, ["druid"]={144}, ["wizard"]={145}, ["oriental"]={146}, ["pirate"]={151}, ["assassin"]={152}, ["beggar"]={153}, ["shaman"]={154}, ["norsewoman"]={251}, ["nightmare"]={268}, ["jester"]={273}, ["brotherhood"]={278}, ["demonhunter"]={289}, ["yalaharian"]={325}, ["warmaster"]={335}, ["wayfarer"]={366} } 
local msg = {"Command requires GOOD param!", "You dont have Addon Doll!", "Bad param!", "Full Addon Set sucesfully added!"} 
local x = string.explode(param) 
	if(getPlayerItemCount(cid, 8982) > 0) then 
		if param ~= "" then 
			if maleOutfits[x[1]:lower()] and femaleOutfits[x[1]:lower()]) then
				if (x[2] == '1' or x[2] == '2') then
					doPlayerRemoveItem(cid, 8982, 1) 
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4]) 
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) 
						if(getPlayerSex(cid) == 0)then 
							doPlayerAddOutfit(cid, femaleOutfits[x[1]:lower()][1], x[2]) 
						else 
							doPlayerAddOutfit(cid, maleOutfits[x[1]:lower()][1], x[2]) 
						end
				else
					doPlayerSendTextMessage(cid, 27, msg[3])
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3])
			end
		else 
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1]) 
		end 
	else 
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2]) 
	end
return true
end
!addon knight, 1

Capturar.jpg
 
Try again.

No errors in console, but when i execute i get:

[16:53:31.066] [Error - TalkAction Interface]
[16:53:31.068] data/talkactions/scripts/addondoll.luanSay
[16:53:31.071] Description:
[16:53:31.073] data/talkactions/scripts/addondoll.lua:8: attempt to index field
'?' (a nil value)
[16:53:31.078] stack traceback:
[16:53:31.080] data/talkactions/scripts/addondoll.lua:8: in function <data/talk
actions/scripts/addondoll.lua:1>
 
Back
Top