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

How do I make a mana check in lua?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,847
Solutions
82
Reaction score
1,955
Location
Germany
Hello it seems like im hella confused.
How do I make a mana check in lua?

Lua:
    local maxMana = player:getMaxMana() / 100 -- percent
    if maxMana < 40 then -- percent aswell
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Not enough mana.")
    else
        print('mana exists')
    end
 
Solution
If you mean check by percentage, it would be something like this


Lua:
local manaP = (player:getMana() / player:getMaxMana()) * 100

    if manaP >= 40 then
        --enough
    else
        --not enough
    end
If you mean check by percentage, it would be something like this


Lua:
local manaP = (player:getMana() / player:getMaxMana()) * 100

    if manaP >= 40 then
        --enough
    else
        --not enough
    end
 
Solution
Back
Top