local config = {
[3100] = {rune = 2268, cost = 1000, backpack_id = 2000, charges = 100}, -- Sudden death
[3101] = {rune = 2273, cost = 1000, backpack_id = 2000, charges = 100}, -- Ultimate Healing
[3102] = {rune = 2279, cost = 1000, backpack_id = 2000, charges = 100}, -- Magic Wall
[3103] = {rune = 2304, cost = 1000, backpack_id = 2001, charges = 100}, -- Greate Fire Ball
[3104] = {rune = 2274, cost = 1000, backpack_id = 2001, charges = 100}, -- avalanche rune
[3105] = {rune = 2278, cost = 1000, backpack_id = 2001, charges = 100}, -- paralyze rune
[3106] = {rune = 2270, cost = 1000, backpack_id = 2001, charges = 100}, -- Manarune
[3107] = {rune = 2305, cost = 1000, backpack_id = 2001, charges = 100}, -- Fire Bomb rune
} -- config end --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local rune = config[item.uid]
if isInArray({1945, 1946}, item.itemid) ~= TRUE then
return TRUE
end
if doPlayerBuyItemContainer(cid, rune.backpack_id, rune.rune, 1, rune.cost, rune.charges) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(rune.rune).." for "..rune.cost.." gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..rune.cost.." gold coins for a backpack "..getItemNameById(rune.rune)..".")
end
return TRUE
end
Use search forum!
Figure out yourself how to use this code!LUA:local config = { [3100] = {rune = 2268, cost = 1000, backpack_id = 2000, charges = 100}, -- Sudden death [3101] = {rune = 2273, cost = 1000, backpack_id = 2000, charges = 100}, -- Ultimate Healing [3102] = {rune = 2279, cost = 1000, backpack_id = 2000, charges = 100}, -- Magic Wall [3103] = {rune = 2304, cost = 1000, backpack_id = 2001, charges = 100}, -- Greate Fire Ball [3104] = {rune = 2274, cost = 1000, backpack_id = 2001, charges = 100}, -- avalanche rune [3105] = {rune = 2278, cost = 1000, backpack_id = 2001, charges = 100}, -- paralyze rune [3106] = {rune = 2270, cost = 1000, backpack_id = 2001, charges = 100}, -- Manarune [3107] = {rune = 2305, cost = 1000, backpack_id = 2001, charges = 100}, -- Fire Bomb rune } -- config end -- function onUse(cid, item, fromPosition, itemEx, toPosition) local rune = config[item.uid] if isInArray({1945, 1946}, item.itemid) ~= TRUE then return TRUE end if doPlayerBuyItemContainer(cid, rune.backpack_id, rune.rune, 1, rune.cost, rune.charges) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(rune.rune).." for "..rune.cost.." gold coins.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..rune.cost.." gold coins for a backpack "..getItemNameById(rune.rune)..".") end return TRUE end
quite easy if you understand this script.
If you can wait a few days, I can create this script for you, if someone else haven't done it before I am finnished with my code ofc
. -Online Shop System.
you mean player click on lever he sells his item? you need one lever for all items, what if he was wearing that item?
some questions to know what you want![]()
Mogex,I can do a script for selling only 1 item.
but not more. So w8 some mins
local item = 2472 --Magic Plate Armor
local cost = 10000
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray({1945, 1946}, item.itemid) ~= TRUE then
return TRUE
end
if doPlayerRemoveItem(cid, item, 1) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You sold a backpack "..getItemNameById(item).." for "..cost.." gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to own "..getItemNameById(item).."")
end
return TRUE
end
Should work (you need to use it multiply times to remove more than 1 of that item.LUA:local item = 2472 --Magic Plate Armor local cost = 10000 function onUse(cid, item, fromPosition, itemEx, toPosition) if isInArray({1945, 1946}, item.itemid) ~= TRUE then return TRUE end if doPlayerRemoveItem(cid, item, 1) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You sold a backpack "..getItemNameById(item).." for "..cost.." gold coins.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to own "..getItemNameById(item).."") end return TRUE end
---Script made by Damadgerz---
--Features : 1- It checks if you are wearing the item you sell or not.If so it send cancel.if not it remove all items you have from this type and give you the money.
-- 2- if you have more than 1 item from the item you sell and if you wearing one of them , the one you are wearing wont be selled. :)
local itemm = 2466 ----item id this for golden armor
local itemslot = CONST_SLOT_ARMOR ---- you can find slots at data-->lib-->000-constant.lua : so if it was a necklace then make it to "CONST_SLOT_NECKLACE"
local cost = 2 --in gold coins
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 1945 then
doTransformItem(item.ud,1946)
return true
end
if getPlayerItemCount(cid,itemm) < 1 then
return doPlayerSendCancel(cid,"You dont have a "..getItemNameById(itemm)..".")
end
if (getPlayerItemCount(cid,itemm) == 1) then
if (getPlayerSlotItem(cid, itemslot).itemid == itemm) then
return doSendMagicEffect(getThingPos(cid),2) and doCreatureSay(cid,"You are wearing that item ",TALKTYPE_MONSTER)
end
return doPlayerRemoveItem(cid, itemm, getPlayerItemCount(cid,itemm)) and doSendMagicEffect(getThingPos(cid),40) and doPlayerAddMoney(cid,cost) and doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have sold a "..getItemNameById(itemm).." for "..cost.." gold coins")
end
if (getPlayerItemCount(cid,itemm) > 1) then
setPlayerStorageValue(cid,1290,getPlayerItemCount(cid,itemm))
doPlayerRemoveItem(cid,itemm,getPlayerItemCount(cid,itemm))
if (getPlayerSlotItem(cid, itemslot).itemid == 0) then
doPlayerAddMoney(cid,cost*(getPlayerStorageValue(cid,1290)-1))
doSendMagicEffect(getThingPos(cid),40)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have sold "..(getPlayerStorageValue(cid,1290)-1).." "..getItemNameById(itemm).." for "..cost*(getPlayerStorageValue(cid,1290)-1).." gold coins")
setPlayerStorageValue(cid,1290,-1)
doPlayerAddItem(cid,itemm,1)
return true
end
return doPlayerAddMoney(cid,cost*(getPlayerStorageValue(cid,1290))) and doSendMagicEffect(getThingPos(cid),40) and doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have sold "..(getPlayerStorageValue(cid,1290)).." "..getItemNameById(itemm).." for "..cost*(getPlayerStorageValue(cid,1290)).." gold coins") and setPlayerStorageValue(cid,1290,-1)
end
end
more advanced so not sell item if ppl have in slot ,and warn them if they have only one of this item as to check if they want before sell
LUA:---Script made by Damadgerz--- --Features : 1- It checks if you are wearing the item you sell or not.If so it send cancel.if not it remove all items you have from this type and give you the money. -- 2- if you have more than 1 item from the item you sell and if you wearing one of them , the one you are wearing wont be selled. :) local itemm = 2466 ----item id this for golden armor local itemslot = CONST_SLOT_ARMOR ---- you can find slots at data-->lib-->000-constant.lua : so if it was a necklace then make it to "CONST_SLOT_NECKLACE" local cost = 2 --in gold coins function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 1945 then doTransformItem(item.ud,1946) return true end if getPlayerItemCount(cid,itemm) < 1 then return doPlayerSendCancel(cid,"You dont have a "..getItemNameById(itemm)..".") end if (getPlayerItemCount(cid,itemm) == 1) then if (getPlayerSlotItem(cid, itemslot).itemid == itemm) then return doSendMagicEffect(getThingPos(cid),2) and doCreatureSay(cid,"You are wearing that item ",TALKTYPE_MONSTER) end return doPlayerRemoveItem(cid, itemm, getPlayerItemCount(cid,itemm)) and doSendMagicEffect(getThingPos(cid),40) and doPlayerAddMoney(cid,cost) and doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have sold a "..getItemNameById(itemm).." for "..cost.." gold coins") end if (getPlayerItemCount(cid,itemm) > 1) then setPlayerStorageValue(cid,1290,getPlayerItemCount(cid,itemm)) doPlayerRemoveItem(cid,itemm,getPlayerItemCount(cid,itemm)) if (getPlayerSlotItem(cid, itemslot).itemid == 0) then doPlayerAddMoney(cid,cost*(getPlayerStorageValue(cid,1290)-1)) doSendMagicEffect(getThingPos(cid),40) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have sold "..(getPlayerStorageValue(cid,1290)-1).." "..getItemNameById(itemm).." for "..cost*(getPlayerStorageValue(cid,1290)-1).." gold coins") setPlayerStorageValue(cid,1290,-1) doPlayerAddItem(cid,itemm,1) return true end return doPlayerAddMoney(cid,cost*(getPlayerStorageValue(cid,1290))) and doSendMagicEffect(getThingPos(cid),40) and doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have sold "..(getPlayerStorageValue(cid,1290)).." "..getItemNameById(itemm).." for "..cost*(getPlayerStorageValue(cid,1290)).." gold coins") and setPlayerStorageValue(cid,1290,-1) end end
@damadgerz
what kind of tabbing is that?..
@damadgerz
what kind of tabbing is that?..
nubish tabbing.