• 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.X+ tfs 1.3 bug with !frags command

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
I kill one player, and when i use !frags, it show all time 23 hours, 59m, 59s, even passing the time:
1570043283718.png
config.lua:
Code:
timeToDecreaseFrags = 24 * 60 * 60 * 1000

!frags.lua
Lua:
function onSay(player, words, param)
    local fragTime = configManager.getNumber(configKeys.FRAG_TIME)
    if fragTime <= 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kills. Red skull at " ..
            configManager.getNumber(configKeys.KILLS_TO_RED) .. " frags. Black skull at " .. configManager.getNumber(configKeys.KILLS_TO_BLACK) .. " frags.")
        return false
    end

    local skullTime = player:getSkullTime()
    if skullTime <= 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,  "You do not have any unjustified kills. Red skull at " ..
            configManager.getNumber(configKeys.KILLS_TO_RED) .. " frags. Black skull at " .. configManager.getNumber(configKeys.KILLS_TO_BLACK) .. " frags.")
        return false
    end

    local kills = math.ceil(skullTime / fragTime)
    local remainingSeconds = math.floor((skullTime % fragTime) / 1000)

    local hours = math.floor(remainingSeconds / 3600)
    local minutes = math.floor((remainingSeconds % 3600) / 60)
    local seconds = remainingSeconds % 60

    local message = "You have " .. kills .. " unjustified kill" .. (kills > 1 and "s" or "") .. ". Red skull at " ..
        configManager.getNumber(configKeys.KILLS_TO_RED) .. " frags. Black skull at " .. configManager.getNumber(configKeys.KILLS_TO_BLACK) ..
        " frags. The amount of unjustified kills will decrease after: "
    if hours ~= 0 then
        if hours == 1 then
            message = message .. hours .. " hour, "
        else
            message = message .. hours .. " hours, "
        end
    end

    if hours ~= 0 or minutes ~= 0 then
        if minutes == 1 then
            message = message .. minutes .. " minute and "
        else
            message = message .. minutes .. " minutes and "
        end
    end

    if seconds == 1 then
        message = message .. seconds .. " second."
    else
        message = message .. seconds .. " seconds."
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message)
    return false
end
 
Why not using the main one which comes with TFS 1.3? kills.lua
it works good and counts time properly.
Lua:
function onSay(player, words, param)
    local fragTime = configManager.getNumber(configKeys.FRAG_TIME)
    if fragTime <= 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kill.")
        return false
    end

    local skullTime = player:getSkullTime()
    if skullTime <= 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kill.")
        return false
    end

    local kills = math.ceil(skullTime / fragTime)
    local remainingSeconds = math.floor((skullTime % fragTime) / 1000)

    local hours = math.floor(remainingSeconds / 3600)
    local minutes = math.floor((remainingSeconds % 3600) / 60)
    local seconds = remainingSeconds % 60

    local message = "You have " .. kills .. " unjustified kill" .. (kills > 1 and "s" or "") .. ". The amount of unjustified kills will decrease after: "
    if hours ~= 0 then
        if hours == 1 then
            message = message .. hours .. " hour, "
        else
            message = message .. hours .. " hours, "
        end
    end

    if hours ~= 0 or minutes ~= 0 then
        if minutes == 1 then
            message = message .. minutes .. " minute and "
        else
            message = message .. minutes .. " minutes and "
        end
    end

    if seconds == 1 then
        message = message .. seconds .. " second."
    else
        message = message .. seconds .. " seconds."
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message)
    return false
end
 
Last edited:
Why not using the main one which comes with TFS 1.3? kills.lua
it works good and counts time properly.
Lua:
function onSay(player, words, param)
    local fragTime = configManager.getNumber(configKeys.FRAG_TIME)
    if fragTime <= 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kill.")
        return false
    end

    local skullTime = player:getSkullTime()
    if skullTime <= 0 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kill.")
        return false
    end

    local kills = math.ceil(skullTime / fragTime)
    local remainingSeconds = math.floor(skullTime % fragTime)

    local hours = math.floor(remainingSeconds / 3600)
    local minutes = math.floor((remainingSeconds % 3600) / 60)
    local seconds = remainingSeconds % 60

    local message = "You have " .. kills .. " unjustified kill" .. (kills > 1 and "s" or "") .. ". The amount of unjustified kills will decrease after: "
    if hours ~= 0 then
        if hours == 1 then
            message = message .. hours .. " hour, "
        else
            message = message .. hours .. " hours, "
        end
    end

    if hours ~= 0 or minutes ~= 0 then
        if minutes == 1 then
            message = message .. minutes .. " minute and "
        else
            message = message .. minutes .. " minutes and "
        end
    end

    if seconds == 1 then
        message = message .. seconds .. " second."
    else
        message = message .. seconds .. " seconds."
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message)
    return false
end
Using your command:
1570284179965.png
probably have an error in time to get the frag, could you help? I use 1.3 downgraded to 8.6

my config.lua
Code:
timeToDecreaseFrags = 24 * 60 * 60 * 1000
 
Back
Top