• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lever Script?

killing

Member
Joined
Feb 23, 2012
Messages
815
Reaction score
11
Location
BIH
Can Someone Create for me Good Lever Script.
#and explain to me how to use it.

--I want to player loss This item ID = "2159"
#Rep++Back^_^

If someone is Thinking to im Noob or Ikd,no need to comment!:mad:

:D
 
What you want?

You want someone pull the lever and lose item id 2159?

Or you want it to add items and remove item id 2159?

Explain better if you want help..
 
Well okay then..

I want when someone pull the lever get item id 7897 and loss the item id 2159 (50 = 2159)

- - - Updated - - -

Im using

[8.60] The Forgotten Server 0.3.6 (Crying Damson) V7
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveItem(cid, 2159, 50) then
       doPlayerAddItem(cid, 7897, 1)
else
       doPlayerSendCancel(cid, 'You need 50 "..getItemPluralNameById(2159).." to use this lever.')
end
return true
end
 
Last edited:
It doesn't matter what you use, if you only have 1 lever, then you can use an unique id, if you are going to use more levers with the same script, then use an action id.
You have to add it to actions.xml with an unique id or action id (depense on what you use). Good thing to remember: onUse means things you click use on. Actions are onUse scripts, so scripts that have function onUse should always go in actions.
Example how to add it with action and unique id to actions.xml
XML:
<action actionid="9000" event="script" value="other/script.lua"/>

<action uniqueid="9000" event="script" value="other/script.lua"/>
The number you choose doesn't matter, but use a number that is not in use yet, unique ids can only be used once and with using a used action id can cause conflicts with other scripts.
 
Last edited:
It doesn't matter what you use, if you only have 1 lever, then you can use an unique id, if you are going to use more levers with the same script, then use an action id.
You have to add it to actions.xml with an unique id or action id (depense on what you use). Good thing to remember: onUse means things you click use on. Actions are onUse scripts, so scripts that have function onUse should always go in actions.
Example how to add it with action and unique id to actions.xml
XML:
<action actionid="9000" event="script" value="other/script.lua"/>

<action uniqueid="9000" event="script" value="other/script.lua"/>
The number you choose doesn't matter, but use a number that is not in use yet, unique ids can only be used once and with using a used action id can cause conflicts with other scripts.


Thanks limos.

- - - Updated - - -

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if doPlayerRemoveItem(cid, 2159, 50) then
       doPlayerAddItem(cid, 7897, 1)
else
       doPlayerSendCancel(cid, 'You need 50 "..getItemPluralNameById(2159).." to use this lever.')
end
return true
end

Thanks Script Work!

- - - Updated - - -

https://i.imgur.com/N0UgWJn.png

:(
 
Movements.xml

You can add other vocations you want to the item if you want more vocations to be able to wear it.
Or you can remove them if you want all vocations to be able to wear it, so it looks like this:
XML:
<movevent type="Equip" itemid="7897" slot="armor" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="7897" slot="armor" event="function" value="onDeEquipItem"/>
 
Last edited:
Movements.xml

You can add other vocations you want to the item if you want more vocations to be able to wear it.
Or you can remove them if you want all vocations to be able to wear it, so it looks like this:
XML:
<movevent type="Equip" itemid="7897" slot="armor" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="7897" slot="armor" event="function" value="onDeEquipItem"/>

thanks Rep++

- - - Updated - - -

IS this Right?

<movevent type="DeEquip" itemid="7897" slot="armor" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="7898" slot="armor" level="50" event="function" value="onEquipItem">
<vocation id="1"/>
<vocation id="5" showInDescription="0"/>
<vocation id="2"/>
<vocation id="6" showInDescription="0"/>
</movevent>
 
That are 2 different armors, I thought you wanted to change 7897. But what you showed here isn't incorrect, it says now that the armor with id 7898 will only work for sorcerers and druids.
 
okay...Now I only understood.. =)

I have only one more Requests..Can u create script for the Forever Blessed aol?it stays forever but wher RS kill i want to player loss Forever Blessed aol?Can u create that?
 
Back
Top