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

Lua Auto Heal Script

Tegardee

The Boss
Joined
Jun 18, 2014
Messages
106
Reaction score
0
Location
Brazil
hello guys, someone have the following script?

if a player have a "ITEM X" equipped on the correct slot. e.g. Energy Ring in the Ring Slot (configurable id of the item in the script), this player have Auto Heal (interval of 3 seconds to each heal) until it is no longer use this item.

thanks for the help.
 
I tried to do by mod using the function "onThink" but don't works. The script is the following.

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Auto Heal" version="1.0" author="Jackss" contact="" enabled="yes">

<event type="login" name="enbAutoHeal" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "AutoHealing")
return true
end
]]></event>

<event type="think" name="AutoHealing" event="script"><![CDATA[

local config = {
slotPos = {CONST_SLOT_RING}, -- Slot The Item Must Be
item = {2121}, -- Id Item That Will Heal
}

function onThink(cid, interval)
  if isCreature(cid) then
  if (getPlayerSlotItem(cid, config.slotPos).itemid == config.item) then
  doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
  doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
  end
  end
end
]]></event>
</mod>
 
Of course, you're doing it wrong..
in function:
Code:
getPlayerSlotItem()
you put the table instead of CONST_SLOT_RING

Try change this
Code:
config.slotPos
To
Code:
config.slotPos[1]
 
Ohh, you have to do it also with
Code:
config.item
to
Code:
config.item[1]

You're putting table where you need to place numbers...


You can also change this
Code:
slotPos = {CONST_SLOT_RING}, -- Slot The Item Must Be
item = {2121}, -- Id Item That Will Heal
To
Code:
slotPos = CONST_SLOT_RING, -- Slot The Item Must Be
item = 2121, -- Id Item That Will Heal

and use config.sloPos or config.item
 
Back
Top