• 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]2 scripts - Soft Boots refiller and simple addon quest

Saint

New Member
Joined
Jun 16, 2007
Messages
231
Reaction score
1
Location
Łódź, Poland
Hello dear OtLand members!

Recently I started new project and I need two little scripts.

1. TalkAction which refills your worn soft boots for a small fee.
2. TalkAction which gives you first/second addon for certain item(s). If possible make a little schema how to fill it and explain it in comments.

Thanks in advance,
Damian.
 
1º Script:

Code:
function onSay(cid, words, param)

local config = {
	wornSoftBoots = XXXX, --id of worn soft boots
	softBoots = XXXX, --id of Soft Boots
	cost = 10000
}

if getPlayerItemCount(cid, config.wornSoftBoots) >= 1 and getPlayerMoney(cid) >= config.cost then
	if(doPlayerRemoveMoney(cid, config.cost) and doPlayerRemoveItem(cid, config.wornSoftBoots, 1)) == TRUE then

	doPlayerAddItem(cid, config.softBoots, 1)

else

	doPlayerSendCancel(cid, "You need a Worn Soft Boots and " .. config.cost .. " gold coins to repair your Soft Boots.")

	end
else

	doPlayerSendCancel(cid, "You need a Worn Soft Boots and " .. config.cost .. " gold coins to repair your Soft Boots.")

	end
end

2º Script

Code:
function onSay(cid, words, param)

local config = {
	outfit = 139, --knigh outfit
	addons = 1, --1 for first addon, 2 for second addon and 3 for both addons
	items = {
		[5880] = 100,
		[5892] = 1
},
	storageID = 10005
}

	for item, count in pairs(config.items) do

	if getPlayerStorageValue(cid, config.storageID) == -1 then
		if getPlayerItemCount(cid, item) >= count then
			if doPlayerRemoveItem(cid, item, count) then

	doPlayerAddOutfit(cid, config.outfit, config.addons)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
	setPlayerStorageValue(cid, config.storageID, 1)

else

	doPlayerSendCancel(cid, "You need 100 Iron Ores and 1 Huge Chunk of Crude Iron to obtain this addon.")

	end
else

	doPlayerSendCancel(cid, "You need 100 Iron Ores and 1 Huge Chunk of Crude Iron to obtain this addon.")

	end
else

	doPlayerSendCancel(cid, "You already have this addon.")

		end
	end
end

Untested!
 
To 2nd:
Code:
local config = {
    payment = 5952,  -- ID of Item which you need to get one addon.
    amount = 1,      -- Amount of Item which you need to get one addon.
    addons = { -- Addon Name, Addon ID, Addon ID, Addon Type, Storage
		["first citizen"] = { 136, 128, 1, 10001 },
		["second citizen"] = { 136, 128, 2, 10002 },
		["first hunter"] = { 137, 129, 1, 20001 },
		["second hunter"] = { 137, 129, 2, 20002 },
		["first knight"] = { 139, 131, 1, 300001 },
		["second knight"] = { 139, 131, 2, 300002 },
		["first mage"] = { 138, 130, 1, 40001 },
		["second mage"] = { 138, 130, 2, 40002 },
		["first summoner"] = { 141, 133, 1, 50001 },
		["second summoner"] = { 141, 133, 2, 50002 },
		["first barbarian"] = { 147, 143, 1, 60001 },
		["second barbarian"] = { 147, 143, 2, 60002 },
		["first druid"] = { 148, 144, 1, 70001 },
		["second druid"] = { 148, 144, 2, 70002 },
		["first nobleman"] = { 140, 132, 1, 80001 },
		["second nobleman"] = { 140, 132, 2, 80002 },
		["first oriental"] = { 150, 146, 1, 99001 },
		["second oriental"] = { 150, 146, 2, 90002 },
		["first warrior"] = { 142, 134, 1, 100001 },
		["second warrior"] = { 142, 134, 2, 100002 },
		["first wizard"] = { 145, 149, 1, 110001 },
		["second wizard"] = { 145, 149, 2, 110002 },
		["first assassin"] = { 156, 152, 1, 120001 },
		["second assassin"] = { 156, 152, 2, 120002 },
		["first beggar"] = { 157, 153, 1, 130001 },
		["second beggar"] = { 157, 153, 2, 130002 },
		["first pirate"] = { 155, 151, 1, 140001 },
		["second pirate"] = { 155, 151, 2, 140002 },
		["first shaman"] = { 158, 154, 1, 150001 },
		["second shaman"] = { 158, 154, 2, 150002 },
		["first norseman"] = { 251, 252, 1, 160001 },
		["second norseman"] = { 251, 252, 2, 160002 },
		["first brotherhood"] = { 278, 279, 1, 170001 },
		["second brotherhood"] = { 278, 279, 2, 170002 },
		["first nightmare"] = { 268, 269, 1, 180001 },
		["second nightmare"] = { 268, 269, 2, 180002 },
		["first jester"] = { 273, 270, 1, 190001 },
		["second jester"] = { 273, 270, 2, 190002 },
		["first demonhunter"] = { 289, 288, 1, 200001 },
		["second demonhunter"] = { 289, 288, 2, 200002 },
		["first yalaharian"] = { 325, 324, 1, 210001 },
		["second yalaharian"] = { 325, 324, 2, 210002 },
    }
}



function onSay(cid, words, param)
	for name, pos in pairs(config.addons) do
		if param == name then
			if getPlayerItemCount(cid,config.payment) >= config.amount then
				addon = getPlayerStorageValue(cid,pos[4])
				if addon == -1 then
					doPlayerAddOutfit(cid, pos[1], pos[3])
					doPlayerAddOutfit(cid, pos[2], pos[3])
					doPlayerRemoveItem(cid,config.payment,config.amount)
					setPlayerStorageValue(cid,pos[4],1)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought the " .. param .. " addon.")
				else
					doPlayerSendCancel(cid, "You already have this addon.")
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
				end
			else
				doPlayerSendCancel(cid, "You don't have a addon scroll to buy this addon.")
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			end
		end
	end
	return TRUE
end
 
1º Script:

Code:
function onSay(cid, words, param)

local config = {
	wornSoftBoots = XXXX, --id of worn soft boots
	softBoots = XXXX, --id of Soft Boots
	cost = 10000
}

if getPlayerItemCount(cid, config.wornSoftBoots) >= 1 and getPlayerMoney(cid) >= config.cost then
	if(doPlayerRemoveMoney(cid, config.cost) and doPlayerRemoveItem(cid, config.wornSoftBoots, 1)) == TRUE then

	doPlayerAddItem(cid, config.softBoots, 1)

else

	doPlayerSendCancel(cid, "You need a Worn Soft Boots and " .. config.cost .. " gold coins to repair your Soft Boots.")

	end
else

	doPlayerSendCancel(cid, "You need a Worn Soft Boots and " .. config.cost .. " gold coins to repair your Soft Boots.")

	end
end

2º Script

Code:
function onSay(cid, words, param)

local config = {
	outfit = 139, --knigh outfit
	addons = 1, --1 for first addon, 2 for second addon and 3 for both addons
	items = {
		[5880] = 100,
		[5892] = 1
},
	storageID = 10005
}

	for item, count in pairs(config.items) do

	if getPlayerStorageValue(cid, config.storageID) == -1 then
		if getPlayerItemCount(cid, item) >= count then
			if doPlayerRemoveItem(cid, item, count) then

	doPlayerAddOutfit(cid, config.outfit, config.addons)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
	setPlayerStorageValue(cid, config.storageID, 1)

else

	doPlayerSendCancel(cid, "You need 100 Iron Ores and 1 Huge Chunk of Crude Iron to obtain this addon.")

	end
else

	doPlayerSendCancel(cid, "You need 100 Iron Ores and 1 Huge Chunk of Crude Iron to obtain this addon.")

	end
else

	doPlayerSendCancel(cid, "You already have this addon.")

		end
	end
end

Untested!

Thanks for your help. I'm going to test it now. I'll edit my post soon.

To 2nd:
Code:
local config = {
    payment = 5952,  -- ID of Item which you need to get one addon.
    amount = 1,      -- Amount of Item which you need to get one addon.
    addons = { -- Addon Name, Addon ID, Addon ID, Addon Type, Storage
		["first citizen"] = { 136, 128, 1, 10001 },
		["second citizen"] = { 136, 128, 2, 10002 },
		["first hunter"] = { 137, 129, 1, 20001 },
		["second hunter"] = { 137, 129, 2, 20002 },
		["first knight"] = { 139, 131, 1, 300001 },
		["second knight"] = { 139, 131, 2, 300002 },
		["first mage"] = { 138, 130, 1, 40001 },
		["second mage"] = { 138, 130, 2, 40002 },
		["first summoner"] = { 141, 133, 1, 50001 },
		["second summoner"] = { 141, 133, 2, 50002 },
		["first barbarian"] = { 147, 143, 1, 60001 },
		["second barbarian"] = { 147, 143, 2, 60002 },
		["first druid"] = { 148, 144, 1, 70001 },
		["second druid"] = { 148, 144, 2, 70002 },
		["first nobleman"] = { 140, 132, 1, 80001 },
		["second nobleman"] = { 140, 132, 2, 80002 },
		["first oriental"] = { 150, 146, 1, 99001 },
		["second oriental"] = { 150, 146, 2, 90002 },
		["first warrior"] = { 142, 134, 1, 100001 },
		["second warrior"] = { 142, 134, 2, 100002 },
		["first wizard"] = { 145, 149, 1, 110001 },
		["second wizard"] = { 145, 149, 2, 110002 },
		["first assassin"] = { 156, 152, 1, 120001 },
		["second assassin"] = { 156, 152, 2, 120002 },
		["first beggar"] = { 157, 153, 1, 130001 },
		["second beggar"] = { 157, 153, 2, 130002 },
		["first pirate"] = { 155, 151, 1, 140001 },
		["second pirate"] = { 155, 151, 2, 140002 },
		["first shaman"] = { 158, 154, 1, 150001 },
		["second shaman"] = { 158, 154, 2, 150002 },
		["first norseman"] = { 251, 252, 1, 160001 },
		["second norseman"] = { 251, 252, 2, 160002 },
		["first brotherhood"] = { 278, 279, 1, 170001 },
		["second brotherhood"] = { 278, 279, 2, 170002 },
		["first nightmare"] = { 268, 269, 1, 180001 },
		["second nightmare"] = { 268, 269, 2, 180002 },
		["first jester"] = { 273, 270, 1, 190001 },
		["second jester"] = { 273, 270, 2, 190002 },
		["first demonhunter"] = { 289, 288, 1, 200001 },
		["second demonhunter"] = { 289, 288, 2, 200002 },
		["first yalaharian"] = { 325, 324, 1, 210001 },
		["second yalaharian"] = { 325, 324, 2, 210002 },
    }
}



function onSay(cid, words, param)
	for name, pos in pairs(config.addons) do
		if param == name then
			if getPlayerItemCount(cid,config.payment) >= config.amount then
				addon = getPlayerStorageValue(cid,pos[4])
				if addon == -1 then
					doPlayerAddOutfit(cid, pos[1], pos[3])
					doPlayerAddOutfit(cid, pos[2], pos[3])
					doPlayerRemoveItem(cid,config.payment,config.amount)
					setPlayerStorageValue(cid,pos[4],1)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought the " .. param .. " addon.")
				else
					doPlayerSendCancel(cid, "You already have this addon.")
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
				end
			else
				doPlayerSendCancel(cid, "You don't have a addon scroll to buy this addon.")
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			end
		end
	end
	return TRUE
end

Thanks for your help, however I need different items for different outfits :P

Kind regards,
Damian.
 
Back
Top