/
kills.lua
46 lines (39 loc) · 1.3 KB
/
kills.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function onSay(player, words, param)
local fragTime = configManager.getNumber(configKeys.FRAG_TIME)
if fragTime <= 0 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have any unjustified kill.")
return false
end
local skullTime = player:getSkullTime()
if skullTime <= 0 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "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_INFO_DESCR, message)
return false
end