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

C++ Bug otx 2

Solution
@Master Frank You're telling me via PM that "your salt is working" on other engine. But salt is not about "working" or not, salt does not need a fix, as I know salt just generate an additional encryption to your accounts and is implemented by default on AAC makers, you can enable or disable that by changing generateAccountSalt = true or false at config.lua.

stackoverflow said:
Salt adds random values to the password hash. Salt is unique to EACH password. (The salt for each password needs to be stored alongside the password). With unique salt for each password, dictionary attacks (password cracking technique) basically have no chance.

Why salt is not that important in this case? Because your accounts are already...
Try this fixes.

login.lua

Code:
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 and getPlayerStorageValue(cid, "bless") ~= 5) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    if(getPlayerStorageValue(cid, "death_bless") == 1) then
        local t = {PLAYERLOSS_EXPERIENCE, PLAYERLOSS_SKILLS, PLAYERLOSS_ITEMS, PLAYERLOSS_CONTAINERS}
        for i = 1, #t do
            doPlayerSetLossPercent(cid, t[i], 100)
        end
        setPlayerStorageValue(cid, "death_bless", 0)
    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_NP, true, cid)
    else
        addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to create an account or {recover} to recover an account.", TALKTYPE_PRIVATE_NP, true, cid)
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "Mail")
    if(getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_LINUX) then
        registerCreatureEvent(cid, "ExtendedOpcode")
    end

    registerCreatureEvent(cid, "ReportBug")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    return true
end

closingdoor.lua

Code:
function onStepOut(cid, item, position, lastPosition)
    if(getTileInfo(position).creatures > 0) then
        return true
    end

    local newPosition = {x = position.x + 1, y = position.y, z = position.z}
    local query = doTileQueryAdd(cid, newPosition)
    if(query == RETURNVALUE_NOTENOUGHROOM) then
        newPosition.x = newPosition.x - 1
        newPosition.y = newPosition.y + 1
        query = doTileQueryAdd(cid, newPosition) -- repeat until found
    end

    if(query == RETURNVALUE_NOERROR and query == RETURNVALUE_NOTENOUGHROOM) then
        doRelocate(position, newPosition)
    end

    position.stackpos = -1
    local i, tileItem, tileCount = 1, {uid = 1}, getTileThingByPos(position)
    while(tileItem.uid ~= 0 and i < tileCount) do
        position.stackpos = i
        tileItem = getTileThingByPos(position)
        if(tileItem.uid ~= 0 and tileItem.uid ~= item.uid and not isMovable(tileItem.uid)) then
            doRemoveItem(tileItem.uid)
        else
            i = i + 1
        end
    end

    local itemInfo = getItemInfo(item.itemid)
    doTransformItem(item.uid, itemInfo.transformUseTo)
    return true
end

function onStepOut(cid, item, position, lastPosition)
    local itemInfo = getItemInfo(item.itemid)
    doTransformItem(item.uid, itemInfo.transformUseTo)
    return true
end

To explain, the getTileThingByPos error might be caused by a bad syntax, like is mentioned here

We will see if this works well for your doors script
Code:
    position.stackpos = -1
    local i, tileItem, tileCount = 1, {uid = 1}, getTileThingByPos(position)
    while(tileItem.uid ~= 0 and i < tileCount) do
        position.stackpos = i
        tileItem = getTileThingByPos(position)
        if(tileItem.uid ~= 0 and tileItem.uid ~= item.uid and not isMovable(tileItem.uid)) then
            doRemoveItem(tileItem.uid)
        else
            i = i + 1
        end
    end

Before posting, it would be nice if you post the scripts with the errors to check where it is failing.
Also, remember to add your custom creature events at the end of login.lua

Regards!
 
@Master Frank You're telling me via PM that "your salt is working" on other engine. But salt is not about "working" or not, salt does not need a fix, as I know salt just generate an additional encryption to your accounts and is implemented by default on AAC makers, you can enable or disable that by changing generateAccountSalt = true or false at config.lua.

stackoverflow said:
Salt adds random values to the password hash. Salt is unique to EACH password. (The salt for each password needs to be stored alongside the password). With unique salt for each password, dictionary attacks (password cracking technique) basically have no chance.

Why salt is not that important in this case? Because your accounts are already encrypted by SHA1. Anyways, the salt encryption should be done automatically once you create a new account, if that is failing, that's what you should say from begining.


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


function onLogin(cid)
        if getCreatureOutfit(cid).lookType == 306 and getPlayerStorageValue(cid, 121219) ~= 1 then
            doCreatureChangeOutfit(cid, getPlayerSex(cid) == 0 and {lookType = 136} or {lookType = 128})
        end
    
        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_NP, true, cid)
    else
        addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to create an account or {recover} to recover an account.", TALKTYPE_PRIVATE_NP, true, cid)
    end
    
        if(not isPlayerGhost(cid)) and (accountManager == MANAGER_NONE) then
            doPlayerPopupFYI(cid, "Player Status\nLevel [".. getPlayerLevel(cid) .."] Reset [".. getPlayerStorageValue(cid, 35100) .."]\nHP: ".. getCreatureHealth(cid) .."/".. getCreatureMaxHealth(cid) .."\nMP: ".. getCreatureMana(cid) .."/".. getCreatureMaxMana(cid) .."\nDano de Ataque: ".. getPlayerStorageValue(cid, 17000) .."\nPoder de Habilidade: ".. getPlayerStorageValue(cid, 15000) .."\nVida Adicional: ".. getPlayerStorageValue(cid, 16000) .."\nMana Adicional: ".. getPlayerStorageValue(cid, 16500) .."\n\nWizard Status\nLevel [".. getPlayerStorageValue(cid, 22500) .."] Reset [".. getPlayerStorageValue(cid, 22550) .."/5]")
            doSendMagicEffect(getCreaturePosition(cid), 40)
        else
            doPlayerSendTextMessage(cid, 19, "Welcome HighExp")
        end
        if(not isPlayerGhost(cid)) and (accountManager == MANAGER_NONE) then
            doPlayerPopupFYI(cid, "Player Status\nLevel [".. getPlayerLevel(cid) .."] Reset [".. getPlayerStorageValue(cid, 35100) .."]\nHP: ".. getCreatureHealth(cid) .."/".. getCreatureMaxHealth(cid) .."\nMP: ".. getCreatureMana(cid) .."/".. getCreatureMaxMana(cid) .."\nDano de Ataque: ".. getPlayerStorageValue(cid, 17000) .."\nPoder de Habilidade: ".. getPlayerStorageValue(cid, 15000) .."\nVida Adicional: ".. getPlayerStorageValue(cid, 16000) .."\nMana Adicional: ".. getPlayerStorageValue(cid, 16500) .."\n\nWizard Status\nLevel [".. getPlayerStorageValue(cid, 22500) .."] Reset [".. getPlayerStorageValue(cid, 22550) .."/5]")
            doSendMagicEffect(getCreaturePosition(cid), 40)
        else
            doPlayerSendTextMessage(cid, 19, "Welcome HighExp")
        end   
    if getPlayerStorageValue(cid, 54304) > 0 then
         doPlayerSetStorageValue(cid, 54304, 0)
     end
    if getPlayerStorageValue(cid, 17000) >= 1001 then
        setPlayerStorageValue(cid, 17000, 1000)
    end
    if getPlayerStorageValue(cid, 15000) >= 1001 then
        setPlayerStorageValue(cid, 15000, 1000)
    end
    if getPlayerStorageValue(cid, 22500) <= -1 then
        setPlayerStorageValue(cid, 22500, 0)
    end
    if getPlayerStorageValue(cid, 22501) <= -1 then
    setPlayerStorageValue(cid, 22501, 0)
    end
    if getPlayerStorageValue(cid, 22550) <= -1 then
        setPlayerStorageValue(cid, 22550, 0)
    end
    if getPlayerStorageValue(cid, 25950) >= 0 then
    setPlayerStorageValue(cid, 25950, -1)
    end
    if getPlayerStorageValue(cid, 196969) - os.time() >= 1 then
    setPlayerStorageValue(cid, 196969, os.time()+3)
    end
    if getPlayerStorageValue(cid, 16000) <= -1 then
        setPlayerStorageValue(cid, 16000, 0)
    end
    if getPlayerStorageValue(cid, 16500) <= -1 then
        setPlayerStorageValue(cid, 16500, 0)
    end
     registerCreatureEvent(cid, "DesertDeath")
     registerCreatureEvent(cid, "DesertCombat")
    registerCreatureEvent(cid, "BattleDeath")
    registerCreatureEvent(cid, "foco")
    registerCreatureEvent(cid, "Apt")
        registerCreatureEvent(cid, "Bpt")
        registerCreatureEvent(cid, "Cpt")
        registerCreatureEvent(cid, "Dpt")
    registerCreatureEvent(cid, "ZombieThink")
    registerCreatureEvent(cid, "ZombieDeath")
     registerCreatureEvent(cid, "BattleCombat")
    registerCreatureEvent(cid, "FireStorm")
     registerCreatureEvent(cid, "ctf")
     registerCreatureEvent(cid, "weapon")
     registerCreatureEvent(cid, "zombieevent")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "tpquest")
    registerCreatureEvent(cid, "CombatDodge")
    registerCreatureEvent(cid, "recompensa")
    registerCreatureEvent(cid, "MonsterCombat")
    registerCreatureEvent(cid, "MonsterAttack")
    registerCreatureEvent(cid, "SkullAmulet")
    registerCreatureEvent(cid, "BountyHunter")
    registerCreatureEvent(cid, "PlayerDeath")
    registerCreatureEvent(cid, "rewardpoints")
    registerCreatureEvent(cid, "autoloot")
    registerCreatureEvent(cid, "Auto Loot")
    registerCreatureEvent(cid, "RecordIp")
    registerCreatureEvent(cid, "lvlup")
    registerCreatureEvent(cid, "lvlup2")
    registerCreatureEvent(cid, "reflect")
    registerCreatureEvent(cid, "KillPlayer")
    registerCreatureEvent(cid, "PetAttack")
    registerCreatureEvent(cid, "EventBoss")
    registerCreatureEvent(cid, "PetCombat")
    registerCreatureEvent(cid, "PetWizard")
    registerCreatureEvent(cid, "AttackTrainer")
    registerCreatureEvent(cid, "soberyan")
    registerCreatureEvent(cid, "sobdeath")
    if (InitArenaScript ~= 0) then
    InitArenaScript = 1
    -- make arena rooms free
        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end
    registerCreatureEvent(cid, "Mail")
    if(getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_LINUX) then
        registerCreatureEvent(cid, "ExtendedOpcode")
    end

    registerCreatureEvent(cid, "ReportBug")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end

registerCreatureEvent(cid, "GuildEvents")
registerCreatureEvent(cid, "critical")
registerCreatureEvent(cid, "heal")
registerCreatureEvent(cid, "BroadDeath")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "fraglook")
registerCreatureEvent(cid, "DanoAd")
registerCreatureEvent(cid, "DeathBroadcast")
registerCreatureEvent(cid, "addons")
registerCreatureEvent(cid, "onPrepareDeath")
registerCreatureEvent(cid, "fraglook")
registerCreatureEvent(cid, "antimb")
registerCreatureEvent(cid, "antimagebomb")
registerCreatureEvent(cid, "redSkullAmulet")
registerCreatureEvent(cid, "FullHpMana")
registerCreatureEvent(cid, "killitem")
registerCreatureEvent(cid, "huntdeath")
registerCreatureEvent(cid, "loguthunt")
registerCreatureEvent(cid, "vipeffect")
registerCreatureEvent(cid, "fimvip")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "CastleExp")
registerCreatureEvent(cid, "DonateAmulet")
registerCreatureEvent(cid, "FreeAmulet")
registerCreatureEvent(cid, "NocAmulet")
registerCreatureEvent(cid, "maxLevel")
registerCreatureEvent(cid, "lvlup1")
registerCreatureEvent(cid, "town")
registerCreatureEvent(cid, "recompensaLvl")
registerCreatureEvent(cid, "critical")
registerCreatureEvent(cid, "Exp")
registerCreatureEvent(cid, "experience")



if getPlayerName(cid) == "Account Manager" and #getPlayersByIp(getPlayerIp(cid)) > 10 then
        return false
    end
 
    
 if getPlayerStorageValue(cid, 48903) == -1 and getPlayerStorageValue(cid, 48902) == -1 then
  setPlayerStorageValue(cid, 48903, 0)
  setPlayerStorageValue(cid, 48902, 0)
 end

 return true
end
 
Back
Top