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

Action Use lever sell item (maybe special) :P

Doggynub

LUA / C++
Joined
Sep 28, 2008
Messages
2,541
Reaction score
186
Every thing explained inside + Features :).

#Another simple usless script#
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 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

in action.xml

Code:
<action [B][I][COLOR="Red"]actionid="1877"[/COLOR][/I][/B] event="script" value="xxxx.lua"/>
There Red thing is the action id you put on the lever.
 
Last edited:
Back
Top