Lbtg
Intermediate OT User
- Joined
- Nov 22, 2008
- Messages
- 2,306
- Reaction score
- 129
Hello anyone could please help me out .
So this script shoud work like this.
First time player click on item, he get 500hp/mp added to hes char, with storage, so player cant use more of those.
So it kinda all works good,
But sometimes if player use some item or spell that boosts hes maxhealth before clicking the item, and he use the item(script) , he gets added much more hp/mp..
Any ideas how to fix it ?
hpmpboost.lua
So this script shoud work like this.
First time player click on item, he get 500hp/mp added to hes char, with storage, so player cant use more of those.
So it kinda all works good,
But sometimes if player use some item or spell that boosts hes maxhealth before clicking the item, and he use the item(script) , he gets added much more hp/mp..
Any ideas how to fix it ?
hpmpboost.lua
Lua:
local cfg = {
storage = 1313353
}
local action = Action()
function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(cfg.storage) >= 1 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You can't use this item anymore.")
player:getPosition():sendMagicEffect(3)
return true
end
player:setMaxHealth(player:getMaxHealth() + 500)
player:setMaxMana(player:getMaxMana() + 500)
player:getPosition():sendMagicEffect(375)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Your Health and Mana has been increased by 500.")
player:setStorageValue(cfg.storage, 1)
item:remove(1)
return true
end
action:id(10455)
action:register()