• 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 Fix !frags and change time to left frags

warriorfrog

Active Member
Joined
Jul 29, 2015
Messages
334
Reaction score
35
Where i change time to lose 1 frag?

And how fix this !frags

https://imgur.com/IBUdeVX

Code:
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
 
What version of TFS are you running?

I'm no expert but it's working fine on TFS 1.2

I think configManager is only available in TFS 1.0 and higher


EDIT:
The time is taken from your config in this case. So you don't need to edit the script if you edit your skulltime in the main config.lua
 
What version of TFS are you running?

I'm no expert but it's working fine on TFS 1.2

I think configManager is only available in TFS 1.0 and higher


EDIT:
The time is taken from your config in this case. So you don't need to edit the script if you edit your skulltime in the main config.lua

Oh sure! Ty... Im using 0.4
You know how change it to work on 0.4?


And i don't found nothing on config.lua could u show me?
 
Oh sure! Ty... Im using 0.4
You know how change it to work on 0.4?


And i don't found nothing on config.lua could u show me?

Code:
configManager.getNumber(configKeys.FRAG_TIME)
This piece of code reads the value FRAG_TIME from the config file.

I'm not sure how to do this in 0.4 since I'm new to all this and don't really have time to investigate.

What you could try is to just copy the values from the config? This isn't the correct way but it should work.
 
Code:
configManager.getNumber(configKeys.FRAG_TIME)
This piece of code reads the value FRAG_TIME from the config file.

I'm not sure how to do this in 0.4 since I'm new to all this and don't really have time to investigate.

What you could try is to just copy the values from the config? This isn't the correct way but it should work.

In your config.lua have some like frag_time? I search 5 times and don't found it...
Can you show me your? Cause i don't know how to add this line...
 
In your config.lua have some like frag_time? I search 5 times and don't found it...
Can you show me your? Cause i don't know how to add this line...
In my config it isn't FRAG_TIME. It might be(Seems like it, can't say with 100% certainty) that FRAG_TIME is just a variable referring to the config key.
In my case it's called: timeToDecreaseFrags
The value of it is 6 * 60 * 60 * 1000
This stands for 6 hours.
hours * 60(minutes in an hour) * 60(seconds in a minute) * 1000(milliseconds in a second)
 
In my config it isn't FRAG_TIME. It might be(Seems like it, can't say with 100% certainty) that FRAG_TIME is just a variable referring to the config key.
In my case it's called: timeToDecreaseFrags
The value of it is 6 * 60 * 60 * 1000
This stands for 6 hours.
hours * 60(minutes in an hour) * 60(seconds in a minute) * 1000(milliseconds in a second)

Ty man!!! I'll try it, now i just need fix !frags to test
 
Back
Top