• 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 How to add hp when you use an item, and remove when you use again?

Slatera

Active Member
Joined
Mar 6, 2009
Messages
521
Reaction score
46
Location
Sweden
In action scripts, how do I make when you use the item, it adds a bit hp, and when you use again it removes it?

I've searched and found nothing, and I'm new to lua. :)

Using TFS 0.3.6pl1.
 
Last edited:
Lua:
function onUse(cid, item, fromPosition, item2, toPosition)
if getPlayerStorageValue(cid,67095) == -1 then
doCreatureAddHealth(cid,500)
setPlayerStorageValue(cid,67095,1)
else
doCreatureAddHealth(cid,-500)
end
return true
end
 
Lua:
local health = 500
function onUse(cid, item, fromPosition, item2, toPosition)
if getPlayerStorageValue(cid,67095) == -1 then
doCreatureAddHealth(cid,health)
setPlayerStorageValue(cid,67095,1)
else
doCreatureAddHealth(cid,-health)
setPlayerStorageValue(cid,67095,-1)
end
return true
end
This one could be used many times.
 
Back
Top