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

Solved [SOLVED]Is there a easier way to put 10% off all prices in a script ?

Swansoft

New Member
Joined
Apr 13, 2013
Messages
49
Reaction score
0
Hi OTLAND

im making a script for my vip town and i was just wondering if i can put 10% off all the potion prices or do i have to take 10% off 1 by 1?



SOLVED
 
Last edited:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
 
 
 
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local STORAGE = 1234
local t = {
							-- [ITEMID TO SELL] = {Buy cost (0 = not buyable), sell cost (0 = not sellable)}
--[[abyss hammer]] [7414] = {price = 20000},
--[[amber staff]] [7426] = {price = 8000},
--[[ancient amulet]] [2142] = {price = 200},
--[[assassin daggerf]] [7404] = {price = 20000},
--[[bandana]] [5917] = {price = 150},
--[[beastslayer axe]] [3962] = {price = 1500},
--[[berserker]] [7403] = {price = 40000},
--[[bone shield]] [2541] = {price = 80},
--[[bonelord helmet]] [3972] = {price = 7500},
--[[brutetamer's staff]] [7379] = {price = 1500},
--[[castle shield]] [2535] = {price = 5000},
--[[chain bolter]] [8850] = {price = 40000},
--[[chaos mace]] [7427] = {price = 9000},
--[[coconut shoes]] [9931] = {price = 500},
--[[composite hornbow]] [8855] = {price = 25000},
--[[cranial basher]] [7415] = {price = 30000},
--[[crocodile boots]] [3982] = {price = 1000},
--[[crystal mace]] [2445] = {price = 12000},
--[[crystal necklace]] [2125] = {price = 400},
--[[crystal ring]] [2124] = {price = 250},
--[[crystal sword]] [7449] = {price = 600},
--[[crystalline armor]] [8878] = {price = 16000},
--[[daramanian mace]] [2439] = {price = 110},
--[[daramanian waraxe]] [2440] = {price = 1000},
--[[dark shield]] [2521] = {price = 400},
--[[death ring]] [6300] = {price = 1000},
--[[demon shield]] [2520] = {price = 30000},
--[[demonbone amulet]] [2136] = {price = 32000},
--[[demonrage sword]] [7382] = {price = 36000},
--[[devil helmet]] [2462] = {price = 1000},
--[[diamond sceptre]] [7387] = {price = 3000},
--[[djinn blade]] [2451] = {price = 15000},
--[[doll]] [2110] = {price = 200},
--[[dragon scale mail]] [2492] = {price = 40000},
--[[dragon slayer]] [7402] = {price = 15000},
--[[dragonbone staff]] [7430] = {price = 3000},
--[[dreaded cleaver]] [7419] = {price = 10000},
--[[dwarven armor]] [2503] = {price = 30000},
--[[earth cranial basher]] [7866] = {price = 30000},
--[[earth dragon slayer]] [7858] = {price = 15000},
--[[earth heroic axe]] [7861] = {price = 30000},
--[[earth mystic blade]] [7856] = {price = 30000},
--[[earth relic sword]] [7855] = {price = 25000},
--[[earth war axe]] [7863] = {price = 12000},
--[[emerald bangle]] [2127] = {price = 800},
--[[energy cranial basher]] [7881] = {price = 30000},
--[[energy dragon slayer]] [7873] = {price = 15000},
--[[energy heroic axe]] [7876] = {price = 30000},
--[[energy mystic blade]] [7871] = {price = 30000},
--[[energy relic sword]] [7870] = {price = 25000},
--[[energy war axe]] [7878] = {price = 12000},
--[[epee]] [2438] = {price = 8000},
--[[fiery cranial basher]] [7756] = {price = 30000},
--[[fiery dragon slayer]] [7748] = {price = 15000},
--[[fiery heroic axe]] [7751] = {price = 30000},
--[[fiery mystic blade]] [7746] = {price = 30000},
--[[fiery relic sword]] [7745] = {price = 25000},
--[[fiery war axe]] [7753] = {price = 12000},
--[[flower wreath]] [9927] = {price = 500},
--[[fur boots]] [7457] = {price = 2000},
--[[furry club]] [7432] = {price = 1000},
--[[glacier amulet]] [7888] = {price = 1500},
--[[glacier kilt]] [7896] = {price = 11000},
--[[glacier mask]] [7902] = {price = 2500},
--[[glacier robe]] [7897] = {price = 11000},
--[[glacier shoes]] [7892] = {price = 2500},
--[[gold ring]] [2179] = {price = 8000},
--[[golden armor]] [2466] = {price = 20000},
--[[golden legs]] [2470] = {price = 30000},
--[[guardian halberd]] [2427] = {price = 11000},
--[[hammer of wrath]] [2444] = {price = 30000},
--[[heavy mace]] [2452] = {price = 50000},
--[[heavy machete]] [2442] = {price = 90},
--[[heroic axe]] [7389] = {price = 30000},
--[[hibiscus dress]] [8873] = {price = 3000},
--[[icy cranial basher]] [7775] = {price = 30000},
--[[icy dragon slayer]] [7767] = {price = 15000},
--[[icy heroic axe]] [7770] = {price = 30000},
--[[icy mystic blade]] [7765] = {price = 30000},
--[[icy relic sword]] [7764] = {price = 25000},
--[[icy war axe]] [7772] = {price = 12000},
--[[jade hammer]] [7422] = {price = 25000},
--[[krimhorn helmet]] [7461] = {price = 200},
--[[lavos armor]] [8877] = {price = 16000},
--[[leaf legs]] [9928] = {price = 500},
--[[leopard armor]] [3968] = {price = 1000},
--[[light shovel]] [5710] = {price = 300},
--[[lightning boots]] [7893] = {price = 2500},
--[[lightning headband]] [7901] = {price = 2500},
--[[lightning legs]] [7895] = {price = 11000},
--[[lightning pendant]] [7889] = {price = 1500},
--[[lightning robe]] [7898] = {price = 11000},
--[[lunar staff]] [7424] = {price = 5000},
--[[magic plate armor]] [2472] = {price = 90000},
--[[magma amulet]] [7890] = {price = 1500},
--[[magma boots]] [7891] = {price = 2500},
--[[magma coat]] [7899] = {price = 11000},
--[[magma legs]] [7894] = {price = 11000},
--[[magma monocle]] [7900] = {price = 2500},
--[[mammoth fur cape]] [7463] = {price = 6000},
--[[mammoth fur shorts]] [7464] = {price = 850},
--[[mammoth whopper]] [7381] = {price = 300},
--[[mastermind shield]] [2514] = {price = 50000},
--[[medusa shield]] [2536] = {price = 9000},
--[[mercenary sword]] [7386] = {price = 12000},
--[[mystic blade]] [7384] = {price = 30000},
--[[naginata]] [2426] = {price = 2000},
--[[nightmare blade]] [7418] = {price = 35000},
--[[noble axe]] [7456] = {price = 10000},
--[[norse shield]] [7460] = {price = 1500},
--[[paladin armor]] [8891] = {price = 15000},
--[[patched boots]] [2641] = {price = 2000},
--[[pharaoh sword]] [2446] = {price = 23000},
--[[pirate boots]] [5462] = {price = 3000},
--[[pirate hat]] [6096] = {price = 1000},
--[[pirate knee breeches]] [5918] = {price = 200},
--[[pirate shirt]] [6095] = {price = 500},
--[[pirate voodoo doll]] [5810] = {price = 500},
--[[platinum amulet]] [2171] = {price = 2500},
--[[ragnir helmet]] [7462] = {price = 400},
--[[relic sword]] [7383] = {price = 25000},
--[[ring of the sky]] [2123] = {price = 30000},
--[[ruby necklace]] [2133] = {price = 2000},
--[[ruthless axe]] [6553] = {price = 45000},
--[[sacred tree amulet]] [10219] = {price = 3000},
--[[sapphire hammer]] [7437] = {price = 7000},
--[[scarab amulet]] [2135] = {price = 200},
--[[scarab shield]] [2540] = {price = 2000},
--[[shockwave amulet]] [10221] = {price = 3000},
--[[silver brooch]] [2134] = {price = 150},
--[[silver dagger]] [2402] = {price = 500},
--[[skull helmet]] [5741] = {price = 40000},
--[[skullcracker armor]] [8889] = {price = 18000},
--[[spiked squelcher]] [7452] = {price = 5000},
--[[steel boots]] [2645] = {price = 30000},
--[[swamplair armor]] [8880] = {price = 16000},
--[[taurus mace]] [7425] = {price = 500},
--[[tempest shield]] [2542] = {price = 35000},
--[[terra amulet]] [7887] = {price = 1500},
--[[terra boots]] [7886] = {price = 2500},	
--[[terra hood]] [7903] = {price = 2500},
--[[terra legs]] [7885] = {price = 11000},
--[[terra mantle]] [7884] = {price = 11000},
--[[tortoise shield]] [6131] = {price = 150},
--[[vile axe]] [7388] = {price = 30000},
--[[voodoo doll]] [3955] = {price = 400},
--[[war axe]] [2454] = {price = 12000},
--[[wyvern fang]] [7408] = {price = 1500}
          }
 
local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
	doPlayerRemoveItem(cid, item, amount)
	if getPlayerStorageValue(cid, STORAGE) == 1 then 
		doPlayerAddMoney(cid, t[item].price*amount) 
		npcHandler:say("You have sold " .. amount .. "x " .. getItemNameById(item) .. " for " .. t[item].price*amount .. " gold.", cid)
	else 
		doPlayerAddMoney(cid, ((t[item].price)-(t[item].price)*0.5)*amount) 
		npcHandler:say("You have sold " .. amount .. "x " .. getItemNameById(item) .. " for " .. ((t[item].price)-(t[item].price)*0.5)*amount .. " gold.", cid)
	end
	return true
end
if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
	if getPlayerStorageValue(cid, STORAGE) == 1 then
		for var, ret in pairs(t) do
			table.insert(shopWindow, {id = var, subType = 0, sell = ret.price, name = getItemNameById(var)})
		end
		openShopWindow(cid, shopWindow, onBuy, onSell) 
	else
		for var, ret in pairs(t) do
			table.insert(shopWindow, {id = var, subType = 0, sell = ((ret.price)-((ret.price)*0.5)), name = getItemNameById(var)})
		end
		openShopWindow(cid, shopWindow, onBuy, onSell) 
	end
	return true
	end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

try editing my version of the script, it uses an storage that when you have it, it sell -50%
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
 
 
 
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local STORAGE = 1234
local t = {
							-- [ITEMID TO SELL] = {Buy cost (0 = not buyable), sell cost (0 = not sellable)}
--[[abyss hammer]] [7414] = {price = 20000},
--[[amber staff]] [7426] = {price = 8000},
--[[ancient amulet]] [2142] = {price = 200},
--[[assassin daggerf]] [7404] = {price = 20000},
--[[bandana]] [5917] = {price = 150},
--[[beastslayer axe]] [3962] = {price = 1500},
--[[berserker]] [7403] = {price = 40000},
--[[bone shield]] [2541] = {price = 80},
--[[bonelord helmet]] [3972] = {price = 7500},
--[[brutetamer's staff]] [7379] = {price = 1500},
--[[castle shield]] [2535] = {price = 5000},
--[[chain bolter]] [8850] = {price = 40000},
--[[chaos mace]] [7427] = {price = 9000},
--[[coconut shoes]] [9931] = {price = 500},
--[[composite hornbow]] [8855] = {price = 25000},
--[[cranial basher]] [7415] = {price = 30000},
--[[crocodile boots]] [3982] = {price = 1000},
--[[crystal mace]] [2445] = {price = 12000},
--[[crystal necklace]] [2125] = {price = 400},
--[[crystal ring]] [2124] = {price = 250},
--[[crystal sword]] [7449] = {price = 600},
--[[crystalline armor]] [8878] = {price = 16000},
--[[daramanian mace]] [2439] = {price = 110},
--[[daramanian waraxe]] [2440] = {price = 1000},
--[[dark shield]] [2521] = {price = 400},
--[[death ring]] [6300] = {price = 1000},
--[[demon shield]] [2520] = {price = 30000},
--[[demonbone amulet]] [2136] = {price = 32000},
--[[demonrage sword]] [7382] = {price = 36000},
--[[devil helmet]] [2462] = {price = 1000},
--[[diamond sceptre]] [7387] = {price = 3000},
--[[djinn blade]] [2451] = {price = 15000},
--[[doll]] [2110] = {price = 200},
--[[dragon scale mail]] [2492] = {price = 40000},
--[[dragon slayer]] [7402] = {price = 15000},
--[[dragonbone staff]] [7430] = {price = 3000},
--[[dreaded cleaver]] [7419] = {price = 10000},
--[[dwarven armor]] [2503] = {price = 30000},
--[[earth cranial basher]] [7866] = {price = 30000},
--[[earth dragon slayer]] [7858] = {price = 15000},
--[[earth heroic axe]] [7861] = {price = 30000},
--[[earth mystic blade]] [7856] = {price = 30000},
--[[earth relic sword]] [7855] = {price = 25000},
--[[earth war axe]] [7863] = {price = 12000},
--[[emerald bangle]] [2127] = {price = 800},
--[[energy cranial basher]] [7881] = {price = 30000},
--[[energy dragon slayer]] [7873] = {price = 15000},
--[[energy heroic axe]] [7876] = {price = 30000},
--[[energy mystic blade]] [7871] = {price = 30000},
--[[energy relic sword]] [7870] = {price = 25000},
--[[energy war axe]] [7878] = {price = 12000},
--[[epee]] [2438] = {price = 8000},
--[[fiery cranial basher]] [7756] = {price = 30000},
--[[fiery dragon slayer]] [7748] = {price = 15000},
--[[fiery heroic axe]] [7751] = {price = 30000},
--[[fiery mystic blade]] [7746] = {price = 30000},
--[[fiery relic sword]] [7745] = {price = 25000},
--[[fiery war axe]] [7753] = {price = 12000},
--[[flower wreath]] [9927] = {price = 500},
--[[fur boots]] [7457] = {price = 2000},
--[[furry club]] [7432] = {price = 1000},
--[[glacier amulet]] [7888] = {price = 1500},
--[[glacier kilt]] [7896] = {price = 11000},
--[[glacier mask]] [7902] = {price = 2500},
--[[glacier robe]] [7897] = {price = 11000},
--[[glacier shoes]] [7892] = {price = 2500},
--[[gold ring]] [2179] = {price = 8000},
--[[golden armor]] [2466] = {price = 20000},
--[[golden legs]] [2470] = {price = 30000},
--[[guardian halberd]] [2427] = {price = 11000},
--[[hammer of wrath]] [2444] = {price = 30000},
--[[heavy mace]] [2452] = {price = 50000},
--[[heavy machete]] [2442] = {price = 90},
--[[heroic axe]] [7389] = {price = 30000},
--[[hibiscus dress]] [8873] = {price = 3000},
--[[icy cranial basher]] [7775] = {price = 30000},
--[[icy dragon slayer]] [7767] = {price = 15000},
--[[icy heroic axe]] [7770] = {price = 30000},
--[[icy mystic blade]] [7765] = {price = 30000},
--[[icy relic sword]] [7764] = {price = 25000},
--[[icy war axe]] [7772] = {price = 12000},
--[[jade hammer]] [7422] = {price = 25000},
--[[krimhorn helmet]] [7461] = {price = 200},
--[[lavos armor]] [8877] = {price = 16000},
--[[leaf legs]] [9928] = {price = 500},
--[[leopard armor]] [3968] = {price = 1000},
--[[light shovel]] [5710] = {price = 300},
--[[lightning boots]] [7893] = {price = 2500},
--[[lightning headband]] [7901] = {price = 2500},
--[[lightning legs]] [7895] = {price = 11000},
--[[lightning pendant]] [7889] = {price = 1500},
--[[lightning robe]] [7898] = {price = 11000},
--[[lunar staff]] [7424] = {price = 5000},
--[[magic plate armor]] [2472] = {price = 90000},
--[[magma amulet]] [7890] = {price = 1500},
--[[magma boots]] [7891] = {price = 2500},
--[[magma coat]] [7899] = {price = 11000},
--[[magma legs]] [7894] = {price = 11000},
--[[magma monocle]] [7900] = {price = 2500},
--[[mammoth fur cape]] [7463] = {price = 6000},
--[[mammoth fur shorts]] [7464] = {price = 850},
--[[mammoth whopper]] [7381] = {price = 300},
--[[mastermind shield]] [2514] = {price = 50000},
--[[medusa shield]] [2536] = {price = 9000},
--[[mercenary sword]] [7386] = {price = 12000},
--[[mystic blade]] [7384] = {price = 30000},
--[[naginata]] [2426] = {price = 2000},
--[[nightmare blade]] [7418] = {price = 35000},
--[[noble axe]] [7456] = {price = 10000},
--[[norse shield]] [7460] = {price = 1500},
--[[paladin armor]] [8891] = {price = 15000},
--[[patched boots]] [2641] = {price = 2000},
--[[pharaoh sword]] [2446] = {price = 23000},
--[[pirate boots]] [5462] = {price = 3000},
--[[pirate hat]] [6096] = {price = 1000},
--[[pirate knee breeches]] [5918] = {price = 200},
--[[pirate shirt]] [6095] = {price = 500},
--[[pirate voodoo doll]] [5810] = {price = 500},
--[[platinum amulet]] [2171] = {price = 2500},
--[[ragnir helmet]] [7462] = {price = 400},
--[[relic sword]] [7383] = {price = 25000},
--[[ring of the sky]] [2123] = {price = 30000},
--[[ruby necklace]] [2133] = {price = 2000},
--[[ruthless axe]] [6553] = {price = 45000},
--[[sacred tree amulet]] [10219] = {price = 3000},
--[[sapphire hammer]] [7437] = {price = 7000},
--[[scarab amulet]] [2135] = {price = 200},
--[[scarab shield]] [2540] = {price = 2000},
--[[shockwave amulet]] [10221] = {price = 3000},
--[[silver brooch]] [2134] = {price = 150},
--[[silver dagger]] [2402] = {price = 500},
--[[skull helmet]] [5741] = {price = 40000},
--[[skullcracker armor]] [8889] = {price = 18000},
--[[spiked squelcher]] [7452] = {price = 5000},
--[[steel boots]] [2645] = {price = 30000},
--[[swamplair armor]] [8880] = {price = 16000},
--[[taurus mace]] [7425] = {price = 500},
--[[tempest shield]] [2542] = {price = 35000},
--[[terra amulet]] [7887] = {price = 1500},
--[[terra boots]] [7886] = {price = 2500},	
--[[terra hood]] [7903] = {price = 2500},
--[[terra legs]] [7885] = {price = 11000},
--[[terra mantle]] [7884] = {price = 11000},
--[[tortoise shield]] [6131] = {price = 150},
--[[vile axe]] [7388] = {price = 30000},
--[[voodoo doll]] [3955] = {price = 400},
--[[war axe]] [2454] = {price = 12000},
--[[wyvern fang]] [7408] = {price = 1500}
          }
 
local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
	doPlayerRemoveItem(cid, item, amount)
	if getPlayerStorageValue(cid, STORAGE) == 1 then 
		doPlayerAddMoney(cid, t[item].price*amount) 
		npcHandler:say("You have sold " .. amount .. "x " .. getItemNameById(item) .. " for " .. t[item].price*amount .. " gold.", cid)
	else 
		doPlayerAddMoney(cid, ((t[item].price)-(t[item].price)*0.5)*amount) 
		npcHandler:say("You have sold " .. amount .. "x " .. getItemNameById(item) .. " for " .. ((t[item].price)-(t[item].price)*0.5)*amount .. " gold.", cid)
	end
	return true
end
if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
	if getPlayerStorageValue(cid, STORAGE) == 1 then
		for var, ret in pairs(t) do
			table.insert(shopWindow, {id = var, subType = 0, sell = ret.price, name = getItemNameById(var)})
		end
		openShopWindow(cid, shopWindow, onBuy, onSell) 
	else
		for var, ret in pairs(t) do
			table.insert(shopWindow, {id = var, subType = 0, sell = ((ret.price)-((ret.price)*0.5)), name = getItemNameById(var)})
		end
		openShopWindow(cid, shopWindow, onBuy, onSell) 
	end
	return true
	end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

try editing my version of the script, it uses an storage that when you have it, it sell -50%

Yo man ill try thanks.
 
Back
Top