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

[TFS 1.3] Killstreak system

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,084
Solutions
15
Reaction score
379
Location
Sweden
YouTube
Joriku
Simple system to get out an amount of killstreaks if it lasts for 10 seconds. Great for war servers.

Lua:
-- Shared on Otland, continue to share scripts with eachother. Regards, Klonera/Joriku.
local storage = 8003
local intervalStorage = 8004
local maxTime = 10 -- max 10 seconds between kill before reset

local streaks = {
    [2] = "DOUBLE KILL!",
    [3] = "TRIPLE KILL!",
    [5] = "M-M-M-MONSTER KILL!!",
    [7] = "RAMPAGE!",
    [9] = "UNSTOPPABLE!",
    [12] = "HOLY SHIT!",
    [15] = "GODLIKE!!"
}

local creatureevent = CreatureEvent("kill_streak")

function creatureevent.onKill(creature, target)
    if creature:isPlayer() and target:isPlayer() then
        if os.time() >= creature:getStorageValue(intervalStorage) then
            creature:setStorageValue(storage, 0)
        end
        creature:setStorageValue(storage, creature:getStorageValue(storage) + 1)
        target:setStorageValue(storage, 0)
        creature:setStorageValue(intervalStorage, os.time() + maxTime)

        for _, pid in ipairs(Game.getPlayers()) do
            local s = {"killed", "cut into pieces", "detonated", "slaughted"}
            --Game.broadcastMessage("".. creature:getName() .." ".. s[math.random(1, #s)] .." ".. target:getName() ..".", MESSAGE_EVENT_ADVANCE)
        end
        local k = streaks[creature:getStorageValue(storage)]
        if k then
            Game.broadcastMessage(creature:getName() .. " - ".. k, MESSAGE_EVENT_ADVANCE)
        end
    end
    return true
end

creatureevent:register()

local creatureevent2 = CreatureEvent("register")

function creatureevent2.onLogin(player)
    player:registerEvent("kill_streak")
    return true
end

creatureevent2:register()
 

Attachments

Last edited by a moderator:
@Klonera im looking for a programmer for simple scripts i wanted to do a war otserver using otbr base and only soulwar maps can you help me ? im streaming can i have your discord?
 
Back
Top