Guitar Freak
_LüA_n☺b_
Hello, Ive been inactive for a while and this might be a silly script (and/or be silly scripted) but I saw someone from an old post with this doubt of "how to prevent an equipped item from being dropped".
Even though he got a solution which was to make a new custom item removing the "moveable" property, here is another solution that I think is easier to apply, for anyone still having this doubt.
In movements.xml: (Im using item 2656, which is a blue robe, for the example)
In Unequipable.lua:
So as you can read from the script what it does is simply if you try to drop a certain equipped item (or move it to any other slot), it removes the item and adds it in the exact same slot (at least it works that way for me), so "to players" it looks simply like it was never moved.
So thats it, I use it on my private server and it works without problem, but if you have any problem dont hesitate to tell me about it Ill see if I can solve it.
Hope it helps, and sorry if it has been done already Im too tired to look right now.
-GF
PS: If you know how to make this for unequipped items AKA "items in containers (bag, bp, etc)" feel free to share, I dont think I can pull that one off with only scripting.
Even though he got a solution which was to make a new custom item removing the "moveable" property, here is another solution that I think is easier to apply, for anyone still having this doubt.
In movements.xml: (Im using item 2656, which is a blue robe, for the example)
PHP:
<movevent type="DeEquip" itemid="2656" slot="armor" event="script" value="Unequipable.lua"/>
In Unequipable.lua:
Lua:
function onDeEquip(cid, item, slot)
doPlayerSendTextMessage(cid, 18, "Sorry, you cannot unequip this item.")
doRemoveItem(item.uid)
doPlayerAddItem(cid, item.itemid)
return 1
end
So as you can read from the script what it does is simply if you try to drop a certain equipped item (or move it to any other slot), it removes the item and adds it in the exact same slot (at least it works that way for me), so "to players" it looks simply like it was never moved.
So thats it, I use it on my private server and it works without problem, but if you have any problem dont hesitate to tell me about it Ill see if I can solve it.
Hope it helps, and sorry if it has been done already Im too tired to look right now.
-GF
PS: If you know how to make this for unequipped items AKA "items in containers (bag, bp, etc)" feel free to share, I dont think I can pull that one off with only scripting.
Last edited: