• 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 Help to fix my !frags

warriorfrog

Active Member
Joined
Jul 29, 2015
Messages
334
Reaction score
35
Using version: 0.4

I need a help to fix my !frags, i want this script because it show how many time left to decay the frag

I think it was 1.0 to run, but i really want it
Someone know a function to declar like remainingSeconds or something to fix it \/?

Code:
local config ={
  useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')),
  advancedFragList = getBooleanFromString(getConfigValue('advancedFragList'))}

function onSay(cid, words, param, channel)
  if(not config.useFragHandler)then
  returnfalse
  end


  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 >1and"s"or"")..". The amount of unjustified kills will decrease after: "
  if hours ~=0then
  if hours ==1then
  message = message .. hours .." hour, "
  else
  message = message .. hours .." hours, "
  end
  end

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

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

  player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message)
  returntrueend

Error
https://i.imgur.com/ZkiU4kt.png
 
Try this:

HTML:
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
 
Try this:

HTML:
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


Im sorry, i was with no internet

Its not work

D7MqanB.png
 
Is not possible a script !frags 0.4 like in underwar?

19:59 You have 1 unjustified kill. The amount of unjustified kills will decrease after: 5 hours, 59 minutes and 57 seconds.
I don't know what underwar is, but 0.3.6 and 0.4 code is the same, that is why i linked you the script.
 
I don't know what underwar is, but 0.3.6 and 0.4 code is the same, that is why i linked you the script.

Underwar is a server
But using your code idk how to change to show
19:59 You have 1 unjustified kill. The amount of unjustified kills will decrease after: 5 hours, 59 minutes and 57 seconds.


sorry my english
 
Back
Top