• 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 Frag counter

Esbuma

New Member
Joined
Apr 19, 2017
Messages
21
Reaction score
1
Having problem with these script.

These is how it should work. When the player use !frags...it show how many unjustified kill you have and the time to decrease that...For exemple a player use !frags and say it have 8 unjustified kills...so the players know he can kill 1 more time before he gets a Red Skull(in my server you get red skull at 10 kills)

Whats the problem with the script:

When you kill someone, it say you dont have unjustified kills, and say that until you get black skull, when you get black skull(in my server is 12 kills) the script show to the player he has 270 unjustified kiills.

Can someone help me fix that?

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


These is my config.lua on the kill part if help
Code:
timeToDecreaseFrags = 4 * 60 * 60 * 1000
whiteSkullTime = 15 * 60 * 1000
experienceByKillingPlayers = false
expFromPlayersLevelRange = 75
dayKillsToRedSkull = 8
dayKillsToBlackSkull = 12
blackSkulledDeathHealth = 40
blackSkulledDeathMana = 0
useBlackSkull = true
redSkullDuration = 30
blackSkullDuration = 45
orangeSkullDuration = 7
 
Back
Top