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

TFS 1.X+ 1.3+ 10.98 item on use give hp/mp bonus

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
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()
 
Back
Top