• 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 Stamina Blessing

Phemus

Member
Joined
Jun 16, 2012
Messages
149
Solutions
2
Reaction score
12
Hello guys, I'm breaking my head with this script that i cannot make it function. I want to make a bless function where if you have more than 40 hours of stamina, you do not lose any skills nor level. This is the script.

Code:
local array = {   
    PLAYERLOSS_EXPERIENCE,
    PLAYERLOSS_MANA,
    PLAYERLOSS_SKILLS,
    PLAYERLOSS_FIGHTING
}

function onPrepareDeath(cid, deathList)
    if getPlayerStamina(cid) >= 2400 then
        for i = 1, #array do
            doPlayerSetLossPercent(cid, array[i], 0)
        end
    end
    return true
end

function onLogin(cid)
    registerCreatureEvent(cid, "Staminabless")
    return true
end

Thank you!
 
I don't see anything wrong with the script, assuming you have both the onPrepareDeath and onLogin registered properly in creaturescripts.xml
Make sure there aren't other scripts executing the same actions.
Typical scripts that usually contain this function are 'aol', 'backpack of holding', 'blessings', et cetera.
Other then that, I can only suggest printing the player values into console, and seeing if they are changing or not.

-- Edit (like 3 hours later.. xD)

Is it the LossPercent your having trouble with, or the stamina check?
 
Last edited:
Back
Top