• 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!

Solved

Thanks :p As I thought then!

btw,
would this work?(I can't test it myself...)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Killing streak" version="1.0" author="Slaktaren" contact="otland.net" enabled="yes">
local cfg = {
    kills = 1234, -- storage
    deaths = 2345, -- storage
    kstreak_msg = {
-- 1,2,3,4,5,6,7 is the storage value, 1 means 2 kills. 2 means 3 kills. 3 means 4 kills and so on. 
-- The default value is -1, which mean 0 kills.
-- For each kill you get +1 value, so if you want a message after 1 kill, just change the number to 0.
-- If you want a message on 3 kills just change the number to 2.
-- I hope you get it.
-- The same on dstreak_msg!
        {1, "Double Kill!"},
        {2, "Triple Kill!"},
        {3, "Quad Kill!"},
        {4, "M-M-M-Monster Kill!!"},
        {5, "BLOODBATH!"},
        {6, "UNSTOPPABLE!"},
        {7, "GODLIKE!!"}},
    dstreak_msg = {
        {1, "on a death streak of 2 deaths in a row!"},
        {2, "on a death streak of 3 deaths in a row!"},
        {3, "on a death streak of 4 deaths in a row!"},
        {4, "on a death streak of 5 deaths in a row!"},
        {5, "on a death streak of 6 or more deaths in a row!"}},
    }
<event type="kill" name="Kill streak" event="script"><![CDATA[
local k = cfg.kstreak_msg[cfg.#kstreak_msg]
local d = cfg.dstreak_msg[cfg.#kstreak_msg]
local ks, ds = getPlayerStorageValue(cid, cfg.kills), getPlayerStorageValue(cid, cfg.deaths)

if ks == k[1] then
    for _, tid in ipairs(getOnlinePlayers()) do
        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. k[2], TALKTYPE_CHANNEL_O, 10)
    end
end
if ks >= 7 then
    for_, tid in ipairs(getOnlinePlayers()) do
        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. cfg.kstreak_msg[7][2], TALKTYPE_CHANNEL_O, 10)
    end
end
if ds = d then
    for _, tid in ipairs(getOnlinePlayers()) do
        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. dmsg, TALKTYPE_CHANNEL_O, 10)
    end
end
if ds >= 5 then
    for _, tid in ipairs(getOnlinePlayers()) do
        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. cfg.dstreak_msg[5][2], TALKTYPE_CHANNEL_O, 10)
    end
end

if isPlayer(cid) then
    setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
    setPlayerStorageValue(cid, cfg.deaths, -1) -- reseting death streak because you died.
end
if isPlayer(target) then
    setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
    setPlayerStorageValue(target, cfg.kills, -1) -- reseting kill streak because you died.
end
]]></event>
</mod>
I think you get what it should do :p
 
Last edited:
I edited the script, found some bugs and added some stuff :p
So would this work ? ;D;D

another question:
How do I get the last item(in this case {7, "GODLIKE!"})? ex:
Code:
local cfg = {
    kstreak_msg = {
        {1, "Double Kill!"},
        {2, "Triple Kill!"},
        {3, "Quad Kill!"},
        {4, "M-M-M-Monster Kill!!"},
        {5, "BLOODBATH!"},
        {6, "UNSTOPPABLE!"},
        {7, "GODLIKE!!"}},
    }
EDIT2; is it like
Code:
cfg.kstreak_msg[7][2]
if so, i want it to be like:
Code:
cfg.kstreak_msg[LAST][2]


EDIT1; sorry for double post
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Killing streak" version="1.0" author="Slaktaren" contact="otland.net" enabled="yes">
	<config name="config"><![CDATA[
		cfg = {
			kills = 1234, -- storage
			deaths = 2345, -- storage
			kstreak_msg = {
				-- 1,2,3,4,5,6,7 is the storage value, 1 means 2 kills. 2 means 3 kills. 3 means 4 kills and so on. 
				-- The default value is -1, which mean 0 kills.
				-- For each kill you get +1 value, so if you want a message after 1 kill, just change the number to 0.
				-- If you want a message on 3 kills just change the number to 2.
				-- I hope you get it.
				-- The same on dstreak_msg!
				{1, "Double Kill!"},
				{2, "Triple Kill!"},
				{3, "Quad Kill!"},
				{4, "M-M-M-Monster Kill!!"},
				{5, "BLOODBATH!"},
				{6, "UNSTOPPABLE!"},
				{7, "GODLIKE!!"}
			},
			dstreak_msg = {
				{1, "on a death streak of 2 deaths in a row!"},
				{2, "on a death streak of 3 deaths in a row!"},
				{3, "on a death streak of 4 deaths in a row!"},
				{4, "on a death streak of 5 deaths in a row!"},
				{5, "on a death streak of 6 or more deaths in a row!"}
			},
		}
	]]></config>
	<event type="kill" name="Kill streak" event="script"><![CDATA[
		domodlib("config")
		local k = cfg.kstreak_msg[cfg.#kstreak_msg]
		local d = cfg.dstreak_msg[cfg.#kstreak_msg]
		local ks, ds = getPlayerStorageValue(cid, cfg.kills), getPlayerStorageValue(cid, cfg.deaths)
		if ks == k[1] then
			for _, tid in ipairs(getOnlinePlayers()) do
				doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. k[2], TALKTYPE_CHANNEL_O, 10)
			end
		end
		if ks >= 7 then
			for _, tid in ipairs(getOnlinePlayers()) do
				doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. cfg.kstreak_msg[7][2], TALKTYPE_CHANNEL_O, 10)
			end
		end
		if ds = d then
			for _, tid in ipairs(getOnlinePlayers()) do
				doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. dmsg, TALKTYPE_CHANNEL_O, 10)
			end
		end
		if ds >= 5 then
			for _, tid in ipairs(getOnlinePlayers()) do
				doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. cfg.dstreak_msg[5][2], TALKTYPE_CHANNEL_O, 10)
			end
		end
		if isPlayer(cid) then
			setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
			setPlayerStorageValue(cid, cfg.deaths, -1) -- reseting death streak because you died.
		end
		if isPlayer(target) then
			setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
			setPlayerStorageValue(target, cfg.kills, -1) -- reseting kill streak because you died.
		end
		return true
	]]></event>
</mod>
 
You don't need the <config CDATA blabla :p Anyways, thanks xD

But is it possible to get the last in kstreak_msg and dstreak_msg? Ex:
Code:
if ks >= cfg.kstreak_msg[LAST][1] then
will get the number from the last line in kstreak_msg. in this case it will get the 7 from {7, "GODLIKE!!"}

EDIT; must spread some rep~ -.- ;(
 
Back
Top