• 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][1.3+][Revscript] Kill Death Ratio - ERRO

maxmedeiros

New Member
Joined
May 16, 2023
Messages
3
Reaction score
0
GitHub
maxmedeiros
Revscript < LINK DO SCRIPT UTILIZADO


CREDITOS: Codinablack

Requer comando SQL executado no banco de dados:

ALTER TABLE players ADD frags INT( 11 ) NOT NULL DEFAULT '0';

ALTER TABLE players ADD deaths INT( 11 ) NOT NULL DEFAULT '0';

1720730639700.png


Alguem consegue me ajudar com esse erro? Meu OT e versao 13.1 Canary.

(obs: esta dando erro nessa parte) ja tentei configurar no player.lua e não consegui.

local look = EventCallback

look.onLook = function(self, player, position, distance, description)
if not player:isPlayer() then
return description
end
local kills = player:getTotalSavedKills()
local deaths = player:getTotalSavedDeaths()
local kdr

if deaths == 0 then
kdr = kills
description = string.format("%s\nThis player killed %s and died %s times. Their KDR is %s", description, kills, deaths, kdr)
return description
end

kdr = kills/deaths
description = string.format("%s\nThis player killed %s and died %s times. Their KDR is %s", description, kills, deaths, kdr)
return description
end

look:register(5)

vlw.
 
LUA:
local killStorage = 884734
local deathStorage = 884735
local toMostDamage = true
local toKiller = true

local event = CreatureEvent("KillandCount")
function event.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if not creature:isPlayer() then return true end
    if creature then
        if killer and killer:isPlayer() and toKiller then
            local killAmount = killer:getStorageValue(killStorage)
            if killAmount == -1 then killAmount = 0 end
            killer:setStorageValue(killStorage, killAmount + 1)
        end
        if mostDamageKiller and mostDamageKiller:isPlayer() and toMostDamageKiller then
            local killAmount = mostDamageKiller:getStorageValue(killStorage)
            if killAmount == -1 then killAmount = 0 end
            mostDamageKiller:setStorageValue(killStorage, killAmount + 1)
        end
        local deathAmount = creature:getStorageValue(deathStorage)
        if deathAmount == -1 then deathAmount = 0 end
        creature:setStorageValue(deathStorage, deathAmount + 1)
    end
    return true
end

event:register()


local eventLogin = CreatureEvent("KillandCountLogin")
function eventLogin.onLogin(player)
    player:registerEvent("KillandCount")
    return true
end

eventLogin:register()


events/player








Code:
    if thing:isPlayer() and not thing:getGroup():getAccess() then
        local killStorage = 884734
        local deathStorage = 884735
        local killAmount, deathAmount = thing:getStorageValue(killStorage), thing:getStorageValue(deathStorage)
        if killAmount == -1 then killAmount = 0 end
        if deathAmount == -1 then deathAmount = 0 end
        description = description .. '\nKilleds: [' ..killAmount..'] and ' .. 'Deaths: ['..deathAmount..']'
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 

Similar threads

Back
Top