• 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 0.X Players bugging HP/Mana

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,403
Solutions
17
Reaction score
151
Location
Brazil
Is there a way to block mana gain from level 1 to 8? My players create level 8 players and die up to 1, as they already have the vocation, the gain in life or mana is higher until 8, so the character doesn't have 185/35, a mage for example, has more than 200 of mana. Is there a way to solve this?
 
Solution
E
disable experience loss if player level is lower than 8, something like this:

Lua:
function onDeath(cid, corpse, deathList)
    if getPlayerLevel(cid) < 8 then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
    end
    return true
end
disable experience loss if player level is lower than 8, something like this:

Lua:
function onDeath(cid, corpse, deathList)
    if getPlayerLevel(cid) < 8 then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
    end
    return true
end
 
Solution
its a creature script, register it as ondeath script and don't forget to register it onLogin too
Have this on creaturescript.xml

XML:
    <event type="death" name="mori" event="script" value="playerdeath.lua"/>

playerdeath.lua

Lua:
function onDeath(cid, corpse, deathList)


    if getPlayerSlotItem(cid, 2).itemid == 2173 then
                doPlayerRemoveItem(cid, 2173, 1)
end



    return true
end

function onDeath(cid, corpse, deathList)
    if getPlayerLevel(cid) < 8 then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
    end
    return true
end

login.lua

Lua:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}


function onLogin(cid)
 
    if(getBooleanFromString(getConfigValue('accountManager')) == false) then
        if (getCreatureName(cid) == "Account Manager") then
            return doRemoveCreature(cid, true)
        end
    end
 
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end
 
    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        addEvent(valid(doCreatureSay), 500, cid, "Hello, it appears that your character has been locked for name violating rules, what new name would you like to have?", TALKTYPE_PRIVATE_NP, true, cid)
    elseif(accountManager == MANAGER_ACCOUNT) then
        addEvent(valid(doCreatureSay), 500, cid, "Hello, type 'account' to manage your account. If you would like to start over, type 'cancel' anywhere.", TALKTYPE_PRIVATE, true, cid)
    else
        addEvent(valid(doCreatureSay), 500, cid, "Hello, type 'account' to create an account or 'recover' to recover an account.", TALKTYPE_PRIVATE, true, cid)
    end
 
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
 
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "ReportBug")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
   
    if getPlayerStorageValue(cid, 48902) == -1 then -- dodge system essential
        setPlayerStorageValue(cid, 48902, 0)
    end
        registerCreatureEvent(cid, "dodge")
 
    registerCreatureEvent(cid, "GuildEvents")
    registerCreatureEvent(cid, "AdvanceSave")
    registerCreatureEvent(cid, "mori")
 
    registerCreatureEvent(cid, "freeextraExperienceScroll")
 
    return true
end


Not worked
Post automatically merged:

Now worked, changed line to
Lua:
if getPlayerLevel(cid) < 9 then
. Thank you
 
Back
Top