• 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 Lose All Level when die

115544

New Member
Joined
Jun 3, 2009
Messages
5
Reaction score
1
Hi!

Im trying to fix this bug but I can't, cause in config.lua doesn't exists Deathlosspercent " ".

And the script in Creaturescripts don't work, don't know why :s

Im using The Forgotten Server - Version 0.3 (Crying Damson). For 7.6

I post my script here. I hope you'll can help me!

Code:
local config = {
    deathListEnabled = getConfigInfo('deathListEnabled'),
    sqlType = getConfigInfo('sqlType'),
    maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, killer)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
    if(config.deathListEnabled == "yes") then
        if(killer ~= FALSE ) then
            if(isPlayer(killer) == TRUE) then
                killerName = getPlayerGUID(killer)
            else
                killerName = getCreatureName(killer)
            end
        else
            killerName = "field item"
        end

        db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(killerName) .. ");")
        local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
        if(rows:getID() ~= -1) then
            local deathRecords = rows:numRows(true)
            if(config.sqlType == "mysql") then
                while(deathRecords > config.maxDeathRecords) do
                    db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
                    deathRecords = deathRecords - 1
                end
            else
                while(deathRecords > config.maxDeathRecords) do
                    db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;")
                    deathRecords = deathRecords - 1
                end
            end
        end
    end
end
 
This script only updates the player death info in the database and sends a textmessage.
Post your login.lua.

Code:
-- The Forgotten Server Config

    -- Account manager
    accountManager = false
    namelockManager = true
    newPlayerChooseVoc = false
    newPlayerSpawnPosX = 33217
    newPlayerSpawnPosY = 31814
    newPlayerSpawnPosZ = 8
    newPlayerTownId = 9
    newPlayerLevel = 8
    newPlayerMagicLevel = 0
    generateAccountNumber = false

    -- Banishments
    notationsToBan = 3
    warningsToFinalBan = 4
    warningsToDeletion = 5
    banLength = 7 * 24 * 60 * 60
    finalBanLength = 30 * 24 * 60 * 60
    ipBanishmentLength = 1 * 24 * 60 * 60
    killsToBan = 5
    maxViolationCommentSize = 200

    -- Battle
    worldType = "pvp"
    protectionLevel = 20
    pvpTileIgnoreLevelAndVocationProtection = true
    killsToRedSkull = 3
    pzLocked = 60 * 1000
    criticalHitChance = 7
    criticalHitMultiplier = 1
    displayCriticalHitNotify = false
    removeWeaponAmmunition = true
    removeWeaponCharges = false
    removeRuneCharges = false
    timeToDecreaseFrags = 24 * 60 * 60 * 1000
    whiteSkullTime = 15 * 60 * 1000
    noDamageToSameLookfeet = false
    experienceByKillingPlayers = false
    showHealingDamage = false
    showHealingDamageForMonsters = false

    -- Connection config
    ip = "46.25.103.132"
    port = 7171
    loginTries = 10
    retryTimeout = 5 * 1000
    loginTimeout = 60 * 1000
    maxPlayers = "1000"
    motd = "Welcome to The Old Times!"
    displayOnOrOffAtCharlist = false
    onePlayerOnlinePerAccount = false
    allowClones = 0
    serverName = "The Old Times"
    loginMessage = "Welcome to The Old Times!"   
    statusTimeout = 5 * 60 * 1000
    replaceKickOnLogin = true

    -- Database
    -- NOTE: sqlFile is used only by sqlite database
    sqlType = "mysql"
    sqlHost = "localhost"
    sqlPort = 3306
    sqlUser = "root"
    sqlPass = "koka23"
    sqlDatabase = "tfs"
    sqlFile = "forgottenserver.sql"
    passwordType = "sha1"

    -- Deathlist
    deathListEnabled = true
    maxDeathRecords = 5

    -- Guilds
    inGameGuildManagement = true
    levelToFormGuild = 8
    guildNameMinLength = 4
    guildNameMaxLength = 20
   
   
    -- Deaths
    -- NOTE: Leave deathLosePercent as -1 if you want to use the default
    -- death penalty formula. For the old formula, set it to 10. For
    -- no skill/experience loss, set it to 0.
    deathLosePercent = 10

    -- Highscores
    highscoreDisplayPlayers = 15
    updateHighscoresAfterMinutes = 60

    -- Houses
    buyableAndSellableHouses = true
    housesPerAccount = 0
    levelToBuyHouse = 1
    houseRentAsPrice = false
    housePriceAsRent = false
    housePriceEachSQM = 1000
    houseRentPeriod = "never"
    houseNeedPremiumAccount = true
    bedsRequirePremium = true

    -- Item usage
    timeBetweenActions = 200
    timeBetweenExActions = 1000

    -- Map
    mapName = "edron"
    cleanProtectedZones = true

    -- Miscellaneous
    -- NOTE: defaultPriority works only on Windows
    dataDirectory = "data/"
    kickIdlePlayerAfterMinutes = 15
    allowChangeOutfit = true
    maxMessageBuffer = 4
    displayGamemastersWithOnlineCommand = false
    defaultPriority = "high"
    saveGlobalStorage = true
    bankSystem = true
    displaySkillLevelOnAdvance = false

    -- Premium account
    freePremium = true
    premiumForPromotion = true
    removePremiumOnInit = true

    -- Rates
    experienceStages = false
    rateExp = 5
    rateSkill = 5
    rateLoot = 6
    rateMagic = 5
    rateSpawn = 1

    -- Party shared exp bonus
    PartyExpBonus = 100
   
    -- Global save
    -- NOTE: globalSaveHour means like 03:00, not that it will save every 3 hours,
    -- if you want such a system use autoSaveEachMinutes. This save method
    -- may be unstable, we recommend using OTAdmin if you want real saves.
    globalSaveEnabled = true
    globalSaveHour = 8
    shutdownAtGlobalSave = true
    cleanMapAtGlobalSave = false

    -- Spawns
    deSpawnRange = 2
    deSpawnRadius = 50

    -- Summons
    maxPlayerSummons = 2

    -- Status
    ownerName = ""
    ownerEmail = "@otland.net"
    url = "http://otland.net/"
    location = "Europe"
 
Back
Top