• 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 Advanced !buyaddon : )

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
All configs in script - for items and/or money! : )
You must add all addon's - i haven't many time. ; )
talkactions.xml
PHP:
<talkaction words="!buyaddon" script="addons.lua"/>
and in scripts - addons.lua:
PHP:
ADDONS = {
	["first citizen"] = { -- outfit name between quoteless
		outfit = {128,136}  -- outfit ids (for male and female)
		addonId = 1, -- outfit id (like 1 for addon number 1) 
		pay = 0, -- cost of addons (can be items and money)
		pacc = 1, -- need pacc for addon? 1 - yes, 0 - no
		level = 50, -- level requipment for addon
		promotion = 0, -- need promotion for addon? 1 - yes, 0 - no
		items = { -- items for addon
			{5878, 100} -- { itemid, count }
		}
		},
	["second citizen"] = {
		outfit = {128,136}
		addonId = 2,
		pay = 0,
		pacc = 1,
		level = 50,
		promotion = 0,
		items = {
			{5902, 50},
			{5890, 100},
			{2480, 1}
		}
	},
	["first nobleman"] = {
		outfit = {140,132}
		addonId = 1,
		pay = 150000,
		pacc = 1,
		level = 150,
		promotion = 1,
		items = {} -- only for money, empty items table!!!
	},
	["second nobleman"] = {
		outfit = {140,132}
		addonId = 2,
		pay = 300000,
		pacc = 1,
		level = 200,
		promotion = 1,
		items = {}
	}
}


function onSay(cid, words, param)
	local addon = ADDONS[string.lower(param)
	local addAddon = 1
	local outfit = addon.outfit
	local getAddon = 0
	if addon then
		if(getPlayerLevel(cid) >= addon.level)then
			if isPremium(cid) == addon.pacc then
				if getPlayerPromotionLevel(cid) >= addon.promotion then
					if getPlayerMoney(cid) >= addon.pay then
						local items = addon.items
						for i=1,#items do
							if addAddon ~= 0 then
								if getPlayerItemCount(cid, items[i][1]) < items[i][2] then
									addAddon = 0
									i = #items
								end
							end
							for i=1, #outfit do
								if getPlayerAddOutfit(cid,outfit[i]) == addon.addonId then
									getAddon = 1
								end
							end
							if getAddon ~= 1 then
								if addAddon == 1 then
									for i=1,#items do
										doPlayerRemoveItem(cid, items[i][1], items[i][2])
									end
									doPlayerRemoveMoney(cid, addon.pay)
										for i=1, #outfit do
											doPlayerAddOutfit(cid,outfit[i], addon.addonId)
										end
								else
									doPlayerSendCancel(cid, "You don't have required items for this addon.")
								end
							else
								doPlayerSendCancel(cid, "You already have this addon.")
							end
						end
					else
						doPlayerSendCancel(cid, "You must pay " .. addon.pay .. " gp for this addon.")
					end
				else
					doPlayerSendCancel(cid, "You need Promotion to buy this addon.")
				end
			else
				doPlayerSendCancel(cid, "You need Premium Account to buy this addon.")
			end
		else
			doPlayerSendCancel(cid, "You need " .. addon.level .. " for this addon.")
		end	
	end
end
 
What is the advanced part of this script? Also I see only 4 possible addons.
hmm? options baby : D
level, pacc, promo etc. i seen many scritps for buy addons in talkactions only for money, not items. : )
 
hmm? options baby : D
level, pacc, promo etc. i seen many scritps for buy addons in talkactions only for money, not items. : )

Yeah I agree with that, thats a good job! But now its only possible to buy 4 addons? So its a bit unfinished:p
 
i don't have many time for add all addons and full job is for lazy, i dedicated this script for admins who ensure that your server is not only putting the finished scripts and counting on earnings ; |
 
LOL omgf, Woot!!
Nice, loool, rotflmao, oneone!!!111!!one

nice script.
wow, lol, omgf!

For seriously, its good, but need some work, to include all addons, without doing any error ;P
good luck!

Kind Regards
Xevis.
 
Back
Top