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

TalkAction /addon V3.0

Master-m

Need help? Just ask!
Senator
Joined
May 28, 2007
Messages
4,338
Reaction score
16
Location
The Netherlands
I release my /addon1 "playername and /addon2 "playername talkactions here only. Please do not post it anywhere else but link to this forum.

First goto /Data/talkactions/talkactions.xml
put this in it:
Code:
	<talkaction words="/addon1" script="addons.lua" />
	<talkaction words="/addon2" script="addons.lua" />

Then goto /Data/talkactions/scripts/
and create a new .lua files called addons.lua.

Put this is addons.lua:

Posted by Colandus:


Found some tiny errors in my version of the script, fixed them:
PHP:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]

-- >>CONFIG<< --
accessToUse = 4 -- What access, or "group id", do you need to use this/these "commands" ?
-- >>CONFIG<< --

function onSay(cid, words, param)
    local addonTypes = {
        ["/addon1"] = {1, "first"},
        ["/addon2"] = {2, "second"}
    }
    local addonType = addonTypes[words]
    if (addonType ~= nil) then
        local playerAccess = (getPlayerGroupId and getPlayerGroupId(cid)) or getPlayerAccess(cid)
        if (playerAccess >= accessToUse) then
            local getPlayer = getPlayerByName(param)
            if (getPlayer > 0) then
                sexAddons = {
                    {[136]=142, [147]=150, [155]=158, [252]=252},
                    {[128]=134, [143]=146, [151]=154, [251]=251}
                }
                local addons = sexAddons[getPlayerSex(getPlayer)+1]
                if (addons ~= nil) then
                    for k, v in pairs(addons) do
                        for i=k, v do
                            doPlayerAddOutfit(getPlayer, i, addonType[1])  
                        end
                    end    
                    doPlayerSendTextMessage(getPlayer, 25, "You have got the " .. addonType[2] .. " addon!")
                    doPlayerSendTextMessage(cid, 21, "You just gave " .. getPlayerName(getPlayer) .. " his " .. addonType[2] .. " addon!")
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Invalid sex of player " .. getPlayerName(getPlayer) .. "!")
                end
            else
                doPlayerSendCancel(cid, "Player is not online.")
            end
        end
    end
end

In global.lua (IF IT DOESN'T EXIST ALREADY)
PHP:
MESSAGE_STATUS_WARNING = 18
You could change the 25 and 21 (line 38, 39) to the variables in global.lua, that'd be better :p

Would be good if someone could test it ;)
 
Last edited:
mater-m i remade this talkaction better with support to norseman outfit and changesex command

addon1.lua
PHP:
function onSay(cid,words,param)
if getPlayerGroupId(cid) >= 4 then

player = getPlayerByName(param)
doPlayerSendTextMessage(player,25,'You have got the first addon!')
doPlayerSendTextMessage(cid,21,"You just gave "..param.." his First addon!")

        for x = 128, 134 do
            doPlayerAddOutfit(cid, x, 1)
        end
        for y = 143, 146 do
            doPlayerAddOutfit(cid, y, 1)
        end
        for z = 151, 154 do
            doPlayerAddOutfit(cid, z, 1)
        end
            doPlayerAddOutfit(cid, 251, 1)
end

addon2.lua
PHP:
function onSay(cid,words,param)
if getPlayerGroupId(cid) >= 4 then

player = getPlayerByName(param)
doPlayerSendTextMessage(player,25,'You have got the first addon!')
doPlayerSendTextMessage(cid,21,"You just gave "..param.." his First addon!")

        for x = 136, 142 do
            doPlayerAddOutfit(cid, x, 2)
        end
        for y = 147, 150 do
            doPlayerAddOutfit(cid, y, 2)
        end
        for z = 155, 158 do
            doPlayerAddOutfit(cid, z, 2)
        end
            doPlayerAddOutfit(cid, 252, 2)
end
 
This is good script: You need update this script because addon2 isn't giving addon for: knight and pirate (males), this is easy but many player don't know who.
And add norseman outfit boths sex ^^

Thx for this release:)
 
This is good script: You need update this script because addon2 isn't giving addon for: knight and pirate (males), this is easy but many player don't know who.
And add norseman outfit boths sex ^^

Thx for this release:)

k thnx for telling me this. When I find some time these days I will update it, or does someone else wants to update it?(you get credits for it ofc.)
 
k thnx for telling me this. When I find some time these days I will update it, or does someone else wants to update it?(you get credits for it ofc.)

Don't worry about credits... I just said i found some issue =p "all don't stay perfect in first time" ^^ But is possible to make all addon in 1 file? less work or more? o_O

Merry Christmas
and
Happy New Year
 
Don't worry about credits... I just said i found some issue =p "all don't stay perfect in first time" ^^ But is possible to make all addon in 1 file? less work or more? o_O

Merry Christmas
and
Happy New Year

Yes is possible o_O When I have time I will fix this also. I hope/think I got some time in some hours :O
 
PHP:
-- This Code is created by master-m from otland.net 
-- I would like to thank Lithium for making the code shorter and Velik for tellling me the missing parts and testing this code.
-- SHORTEN BY COLANDUS and a bug fix also (an end was missing)! ;D
function onSay(cid,words,param)
	local addonTypes = {
		"/addon1" = {1, "first"},
		"/addon2" = {2, "second"}
	}
	local addonType = addonTypes[word] or 0
	if atype > 0 then
		if getPlayerGroupId(cid) >= 4 then
			local player = getPlayerByName(param)
			local addons = {}
			doPlayerSendTextMessage(player, 25, 'You have got the ' .. addonType[2] .. ' addon!')
			doPlayerSendTextMessage(cid, 21 , 'You just gave ' .. param .. ' his ' .. addonType[2] .. ' addon!')
			if getPlayerSex(player) == 1 then
				addons = {128=134, 143=146, 151=154, 251=251}
			elseif getPlayerSex(player) == 0 then
				addons = {136=142, 147=150, 155=158, 252=252}
			end
			for k, v in pairs(addons) do
				for i=k, v do
					doPlayerAddOutfit(player, i, atype[1])
				end
			end	
		end
	end
end

Fixed ;)
 
Last edited:
Code:
-- This Code is created by master-m from otland.net 
-- I would like to thank Lithium for making the code shorter and Velik for tellling me the missing parts and testing this code.
function onSay(cid,words,param)
	if words == '/addon1' then
		atype = 1
	elseif words == '/addon2' then
		atype = 2
	end
	if atype ~= nil then
		if getPlayerGroupId(cid) >= 4 then
			local player = getPlayerByName(param)
			local addons = {}
			doPlayerSendTextMessage(player,25,'You have got the first addon!')
			doPlayerSendTextMessage(cid,21,"You just gave "..param.." his First addon!")
			if getPlayerSex(player) == 1 then
				addons = {128=134, 143=146, 151=154, 251=251}
			elseif getPlayerSex(player) == 0 then
				addons = {136=142, 147=150, 155=158, 252=252}
			end
			for k, v in pairs(addons) do
				for i=k, v do
					doPlayerAddOutfit(player, i, atype)
				end
			end	
		end
	end
end

Fixed ;)

Please put on top -- Your name and what you have changed^^
Then people know you fixed it ;)
 
Found some tiny errors in my version of the script, fixed them:
PHP:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]

-- >>CONFIG<< --
accessToUse = 4 -- What access, or "group id", do you need to use this/these "commands" ?
-- >>CONFIG<< --

function onSay(cid, words, param)
	local addonTypes = {
		["/addon1"] = {1, "first"},
		["/addon2"] = {2, "second"}
	}
	local addonType = addonTypes[words]
	if (addonType ~= nil) then
		local playerAccess = (getPlayerGroupId and getPlayerGroupId(cid)) or getPlayerAccess(cid)
		if (playerAccess >= accessToUse) then
			local getPlayer = getPlayerByName(param)
			if (getPlayer > 0) then
				sexAddons = {
					{[136]=142, [147]=150, [155]=158, [252]=252},
					{[128]=134, [143]=146, [151]=154, [251]=251}
				}
				local addons = sexAddons[getPlayerSex(getPlayer)-1]
				if (addons ~= nil) then
					for k, v in pairs(addons) do
						for i=k, v do
							doPlayerAddOutfit(player, i, addonType[1])
						end
					end	
					doPlayerSendTextMessage(getPlayer, 25, "You have got the " .. addonType[2] .. " addon!")
					doPlayerSendTextMessage(cid, 21, "You just gave " .. getPlayerName(getPlayer) .. " his " .. addonType[2] .. " addon!")
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Invalid sex of player " .. getPlayerName(getPlayer) .. "!")
				end
			else
				doPlayerSendCancel(cid, "Player is not online.")
			end
		end
	end
end

In global.lua (IF IT DOESN'T EXIST ALREADY)
PHP:
MESSAGE_STATUS_WARNING = 18
You could change the 25 and 21 (line 38, 39) to the variables in global.lua, that'd be better :p

Would be good if someone could test it ;)
 
Last edited:
Back
Top