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

I need a Script Lever

Mogex

Active Member
Joined
May 29, 2010
Messages
1,513
Reaction score
27
Dear Otlanders!

I whant a script for sell items with lever pleasE!
Can someone give me it?
 
Use search forum!
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
Figure out yourself how to use this code!
 
Use search forum!
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
Figure out yourself how to use this code!


Sorry i said for sell not for buy. u give DSM AND GET 4CC
thanks for help
 
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.

u are a nice person thanks.

Look: the scripts changed a lot so what i whant you to know is:
Is the same script for buy mmm.. Aol for example
But i don't whana lever to buy aol because i have i
whant it for sell item.
So you press lever and you recieve a msage "You have sold Dragon scale mail for 40000 gold coins"
Or "Sold!"
 
can do this fast for you, w8 some mins..

Okey I take back my words about easy to remake!!
Became much harder when you tries to use same lever for everything :D
 
Last edited:
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 :)
 
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
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
Should work (you need to use it multiply times to remove more than 1 of that item.

Thanks really i repp you.
u are the best! (L)
 
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
 
Last edited:
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

Thanks a lot!
REP+++++++++ OFC
 
Back
Top