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

Sklep z potionami na dźwignie :)

tibian1234

New Member
Joined
Sep 7, 2009
Messages
13
Reaction score
0
Witam
Poszukuję skryptu dzięki któremu po przesunięciu danej dźwigni kupie np . 200 gmp złączonych w backpacku czy tam sd itp.
Za pomoc z góry dziękuje dodam że używam TFS 0.4 r3777 (8.6) .Pozdrawiam
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local c = {

	[1515] = {potion_id = 7590, count = 1, cost_ea = 20},
	[1520] = {potion_id = 7589, count = 1, cost_ea = 20},
	[1516] = {potion_id = 7591, count = 1, cost_ea = 20},
	[1519] = {potion_id = 7588, count = 1, cost_ea = 20},
	[1522] = {potion_id = 8473, count = 1, cost_ea = 20},
	[1520] = {potion_id = 7589, count = 1, cost_ea = 20},
	[1521] = {potion_id = 8472, count = 1, cost_ea = 20},



	}
costam = c[item.uid]
	if costam then
		if getPlayerMoney(cid) >= (costam.count * costam.cost_ea) then
		doPlayerRemoveMoney(cid, (costam.count * costam.cost_ea))
		doPlayerAddItem(cid, costam.potion_id, costam.count)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Kupiles ".. costam.count .."x "..getItemNameById(costam.potion_id).." za "..(costam.count * costam.cost_ea).." gold coins.")
		else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Nie masz "..(costam.count * costam.cost_ea).." gold coins.")
		end
	end





return true
end
 
Poproszę o krótki opis instalacji , postawiłem w map edytorze dzwignie itp ale cos mi nie wyszlo; D
Wpisałem id potów itp count cost wrzucilem do actions ale porobily sie takto duplicaty .. a dzwigni nie mozna ruszyc nawet ; x

- - - Updated - - -

Pomoże ktoś ? Jak to zainstalować żeby było ok ? :D
 
Poradziłem sobie troche innym skryptem , Wystarczy wkleić do mods pozmieniać id itp i hula az miło.Udostępniam niżej ten kod może komuś się przyda :) POZDRO I DZIĘKI ZA POMOC ! :)

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Buy item by lever" version="1.0" author="Darkhaos" contact="otland.net" enabled="yes">
	<config name="switch_items"><![CDATA[
		uid = {
			[5556] = {item = 7590, count = 200, charges = 1, cost = 24020, backpack = true, backpackID = 2001, ignoreCap = false},
			[5557] = {item = 7589, count = 200, charges = 1, cost = 16020, backpack = true, backpackID = 2001, ignoreCap = false},
			[5558] = {item = 7620, count = 200, charges = 1, cost = 10020, backpack = true, backpackID = 2001, ignoreCap = false},
			[5559] = {item = 8473, count = 200, charges = 1, cost = 62020, backpack = true, backpackID = 2000, ignoreCap = false},
			[5560] = {item = 7591, count = 200, charges = 1, cost = 38020, backpack = true, backpackID = 2000, ignoreCap = false},
			[5561] = {item = 7588, count = 200, charges = 1, cost = 20020, backpack = true, backpackID = 2000, ignoreCap = false},
			[5562] = {item = 7618, count = 200, charges = 1, cost = 9020, backpack = true, backpackID = 2000, ignoreCap = false},
			[5563] = {item = 8472, count = 200, charges = 1, cost = 38020, backpack = true, backpackID = 2004, ignoreCap = false},
			[5564] = {item = 2268, count = 200, charges = 1, cost = 10020, backpack = true, backpackID = 2003, ignoreCap = false},
			
		}
 
		levers = {
			1945,
			1946
		}
	]]></config>
	<action fromuid="5556" touid="5564" event="buffer"><![CDATA[
	domodlib('switch_items')
 
	if isInArray(levers, item.itemid) then
		doTransformItem(item.uid, (item.itemid == 1945 and 1946 or 1945)) 
		local item = uid[item.uid]
		if item then
			if item.backpack then
				if getPlayerMoney(cid) < item.cost then
					doPlayerSendCancel(cid, "You need " .. item.cost .. " gold coins to buy a backpack of " .. getItemNameById(item.item) .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				if not item.ignoreCap and getPlayerFreeCap(cid) < (getItemWeightById(item.backpackID, item.backpackCount) + getItemWeightById(item.item, item.count)) then
					doPlayerSendCancel(cid, "You don't have enough cap.")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				local deny = false
				if not isItemContainer(item.backpackID) then deny = true end
				if not deny then
					local container = doPlayerAddItem(cid, item.backpackID, 1)
					for i = 1, item.count do
						doAddContainerItem(container, item.item, item.charges)
					end
					doPlayerRemoveMoney(cid, item.cost)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. item.count .. "x " .. getItemNameById(item.item) .. (item.count > 1 and "s" or "") .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
				else
					error("[Warning - Error] Cannot add items in container id " .. item.backpackID .. ".")
				end
			else
				if getPlayerMoney(cid) < item.cost then
					doPlayerSendCancel(cid, "You need " .. item.cost .. " gold coins to buy " .. getItemArticleById(item.item) .. " " .. getItemNameById(item.item) .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				if not item.ignoreCap and getPlayerFreeCap(cid) < getItemWeightById(item.item, item.count) then
					doPlayerSendCancel(cid, "You don't have enough cap.")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				for i = 1, item.count do
					doPlayerAddItem(cid, item.item, item.charges)
				end
				doPlayerRemoveMoney(cid, item.cost)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. item.count .. "x " .. getItemNameById(item.item) .. (item.count > 1 and "s" or "") .. ".")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
			end
		end
	end
	]]></action>
</mod>
 
1. Nie masz donatora, sprawa została zgłoszona
2. Tak kurwa trudno poszukać na forum? A nie zapomniałem lepiej po spamować na pb niech murzyny to zrobią...
 
1. Nie masz donatora, sprawa została zgłoszona
2. Tak kurwa trudno poszukać na forum? A nie zapomniałem lepiej po spamować na pb niech murzyny to zrobią...

nom

#temat

modsy ponoć jakoś dziwnie działają, zwłaszcza gdy mają addeventy i funkcje z wykorzystaniem dat (tutaj tego to nie dotyczy, ale ogólnie tak)

i btw. skrypt przez ximmiego podany jest git i lepiej naucz się poprawiać i operować na actionach niż tylko liczyć na mods;a
 
Back
Top