Fixed maxspree message being printed when first spree > 5

This commit is contained in:
Timo Smit 2017-03-13 17:19:35 +01:00
parent 17ea943c64
commit d31c6ff0a0

View file

@ -211,6 +211,7 @@ function sprees.onPlayerSpree(clientId, type, sourceId)
local settingSpreeMessages = settings.get("g_spreeMessages") local settingSpreeMessages = settings.get("g_spreeMessages")
if settingSpreeMessages ~= 0 and bits.hasbit(settingSpreeMessages, 2^type) and #spreeMessagesByType[type] > 0 then if settingSpreeMessages ~= 0 and bits.hasbit(settingSpreeMessages, 2^type) and #spreeMessagesByType[type] > 0 then
local spreeMessage = spreeMessages[type][currentSpree] local spreeMessage = spreeMessages[type][currentSpree]
local maxSpreeMessage = spreeMessagesByType[type][#spreeMessagesByType[type]]
if spreeMessage then if spreeMessage then
local msg = string.format("^1%s SPREE! ^*%s ^*%s ^d(^3%d ^d%ss in a row!)", local msg = string.format("^1%s SPREE! ^*%s ^*%s ^d(^3%d ^d%ss in a row!)",
@ -225,9 +226,7 @@ function sprees.onPlayerSpree(clientId, type, sourceId)
end end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \""..msg.."\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \""..msg.."\";")
elseif currentSpree % 5 == 0 then elseif currentSpree % 5 == 0 and currentSpree > maxSpreeMessage["amount"] then
local maxSpreeMessage = spreeMessagesByType[type][#spreeMessagesByType[type]]
local msg = string.format("^1%s SPREE! ^*%s ^*%s ^d(^3%d ^d%ss in a row!)", local msg = string.format("^1%s SPREE! ^*%s ^*%s ^d(^3%d ^d%ss in a row!)",
string.upper(spreeNames[type]), string.upper(spreeNames[type]),
players.getName(clientId), players.getName(clientId),