• 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] Total invisibility [SOLVED]

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,321
Reaction score
18
Location
Sweden - Dalarna
Solved the invisibility problem ;p
Now it's just this part;
Solved this part too ;p Just had to add cid;p
addEvent(removeInvisible, cfg.invisible_time * 1000, cid)
Code:
function removeInvisible(cid)
    doCreatureExecuteTalkAction(cid, "/ghost", true)
end
function cd(cid)
    setPlayerStorageValue(cid, cfg.invisible_onCooldown, 0)
end

addEvent(cd, cfg.invisible_cooldown * 1000)
addEvent(removeInvisible, cfg.invisible_time * 1000)
(not the whole script ;p just the addEvent part, as that is the part failing ;s)
Code:
[Error - TalkAction Interface]
In a timer event called from:
data/talkactions/scripts/kill streaks/features.lua:onSay
Description:
(luaDoCreatureSetStorage) Creature not found

[Error - TalkAction Interface]
In a timer event called from:
data/talkactions/scripts/kill streaks/features.lua:onSay
Description:
(luaDoCreatureExecuteTalkaction) Creature not found
 
Last edited:
you could do it like this..(Very Shitty Example xD)

Lua:
function addInvisible(cid)
doCreatureExecuteTalkAction(cid, "/ghost", true) 
return true
end

function stopInvisible(cid)
doCreatureExecuteTalkAction(cid, "/ghost", true) 
return true
end

function onSay(cid, words, param)
addEvent(addInvisible, 4000, cid) 
addEvent(stopInvisible, 20000, cid)   
   return true
end

Just make an event to make the player Say the Words, And when player uses the command make another vent for a later time to use the same command again and it will shut it off? :thumbup:
 
The invisible part is already fixed i think, but if my part doesn't work I'll test yours ;p thanks.


@Existance;p
the cfg
Code:
local cfg = {
    resetStreaksOnLogin = true, -- true/false. If true: When you login your deaths and kills streaks will be reseted to 0.
    kills = 1000, -- storage.
    deaths = 1001, -- storage.
    channel = 10, -- In this channel the script will be broadcasting. Channel ID, not name ;p
    
    -- Explode
    useExplodeOnDeath = true, -- true/false. if true: when you die you will explode when you die causing X dmg in a specified area.
    explodeEffect = CONST_ME_FIREATTACK, -- Effect on the explosion.
    explodeDamage = 500, -- How much damage will the explosion do when you die.
    killsToExplode = 5, -- If you have 5 kills or more you will explode on death if explodeOnDeath is true.
    bomb_area = {5, 5}, -- How many sqms will the bomb cover? default 5x5. x, y.
    
    -- Replenish - Talkaction: !restore
    useReplenish = true, -- true/false. If true: Will restore X health and X mana.
    replenish_healthAmount = math.random(350,700), -- How much health will be restored when used.
    replenish_manaAmount = math.random(250,550), -- How much mana will be restored when used.
    replenish_cooldown = 40, -- How long you have to wait until you can use it again, in seconds.
    replenish_charges = 5, -- How many times you can restore your health and mana.
    replenish_reqKills = 7, -- How many kills you need to be able to use !restore.
    replenish_chargeStorage = 1002, -- Storage needed to store charges.
    replenish_alreadyGiven = 1003, -- storage
    replenish_onCooldown = 1004, -- storage
    
    -- Immortality -- Talkaction: !immortal
    useImmortality = true, -- true/false. If true: You can activate immortality, makes you invulnerable against incoming damage for X seconds.
    immortal_broadcast = true, -- true/false. If true: The script will broadcast in the channel you specified in "channel" that a player used the immortality.
    immortal_useEffect = true, -- true/false. If true: An effect will appear on the player who is immortal.
    immortal_effect = CONST_ME_HOLYAREA, -- If immortal_useEffect = true then you will get this effect on a immortal player every X seconds(scroll down to the global event to set how often)
    immortal_reqKills = 10, -- How many kills you need to be able to activate immortality.
    immortal_time = 25, -- How long will you be immortal, in seconds.
    immortal_cooldown = 240, -- How long you must wait until you can make yourself immortal again, in seconds.
    immortal_charges = 2, -- How many times you can use immortality.
    immortal_chargeStorage = 1005, -- Storage for charges.
    immortal_storageActive = 1006, -- Storage when you are immortal
    immortal_alreadyGiven = 1007, -- storage
    immortal_onCooldown = 1008, -- storage
        
    -- Invisibilty - Talkaction: !stealth
    useInvisibility =  true, -- true/false. If true: Will make you invisible for X seconds. Invisible to EVERYTHING, even players.
    invisible_broadcast = true, -- true/false. If true: Will broadcast in the channel you specified in "channel" that a player used the Invisiblity skill.
    invisible_reqKills = 10, -- How many kills you need to be able to use the invisibility skill.
    invisible_time = 25, -- How long you will be invisible, in seconds.
    invisible_cooldown = 180, -- How long you will have to wait until you can use the invisibility skill again.
    invisible_timeStorage = 1009, -- storage
    invisible_chargeStorage = 1010, -- storage
    invisible_alreadyGiven = 1011, -- storage
    invisible_onCooldown = 1012, -- storage
    invisible_storageActive = 1013, -- storage
    }
    
    local kstreak = {
        {kills = 2, msg = "Double Kill!"},
        {kills = 3, msg = "Triple Kill!"},
        {kills = 4, msg = "Quad Kill!"},
        {kills = 5, msg = "M-M-M-Monster Kill!!"},
        {kills = 6, msg = "BLOODBATH!"},
        {kills = 7, msg = "UNSTOPPABLE!"},
        {kills = 8, msg = "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
    local dstreak = {
        {deaths = 2, msg = "on a death streak of 2 deaths in a row!"},
        {deaths = 3, msg = "on a death streak of 3 deaths in a row!"},
        {deaths = 4, msg = "on a death streak of 4 deaths in a row!"},
        {deaths = 5, msg = "on a death streak of 5 deaths in a row!"},
        {deaths = 6, msg = "on a death streak of 6 or more deaths in a row!"}} -- Will be sent when you got this much deaths or more.
Code:
function onKill(cid, target, lastHit)
    for k = kstreak[1], kstreak[math.max(1, #kstreak)] do
        for d = dstreak[1], dstreak[math.max(1, #dstreak)] do
            local vk = kstreak[#kstreak]
            local vd = dstreak[#dstreak]

            if getPlayerStorageValue(cid, cfg.kills) == vk.kills then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. vk.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            elseif getPlayerStorageValue(cid, cfg.kills) > k.kills then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. k.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            end
            if getPlayerStorageValue(target, cfg.deaths) == vd.deaths then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. vd.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            elseif getPlayerStorageValue(target, cfg.deaths) > d.deaths then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. d.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            end
        end
    end

    if isPlayer(cid) then
        setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
        setPlayerStorageValue(cid, cfg.deaths, 0) -- reseting death streak because you killed someone.
        if cfg.useReplenish then
            if getPlayerStorageValue(cid, cfg.kills) >= cfg.replenish_reqKills and getPlayerStorageValue(cid, cfg.replenish_alreadyGiven) ~= 1 then
                setPlayerStorageValue(cid, cfg.replenish_chargeStorage, cfg.replenish_charges)
                setPlayerStorageValue(cid, cfg.replenish_alreadyGiven, 1)
            end
        end
        if cfg.useImmortality then
            if getPlayerStorageValue(cid, cfg.kills) >= cfg.immortal_reqKills and getPlayerStorageValue(cid, cfg.immortal_alreadyGiven) ~= 1 then
                setPlayerStorageValue(cid, cfg.immortal_chargeStorage, cfg.immortal_charges)
                setPlayerStorageValue(cid, cfg.immortal_alreadyGiven, 1)
            end
        end
        if cfg.useInvisibility then
            if getPlayerStorageValue(cid, cfg.kills) >= cfg.invisible_reqKills and getPlayerStorageValue(cid, cfg.invisible_alreadyGiven) ~= 1 then
                setPlayerStorageValue(cid, cfg.invisible_cargeStorage, cfg.invisible_charges)
                setPlayerStorageValue(cid, cfg.invisible_alreadyGiven, 1)
            end
        end
    end
    if isPlayer(target) then
        if cfg.useExplodeOnDeath and getPlayerStorageValue(target, cfg.kills) >= cfg.killsToExplode then
            local fromPos = {getPlayerPosition(target).x-cfg.bomb_area[1], getPlayerPosition(target).y-cfg.bomb_area[2], getPlayerPosition(target).z}
        local toPos = {getPlayerPosition(target).x+cfg.bomb_area[1], getPlayerPosition(target).y+cfg.bomb_area[2], getPlayerPosition(target).z}
            for x = fromPos[1], toPos[1] do
                for y = fromPos[2], toPos[2] do
                    for z = fromPos[3], toPos[3] do
                    local explode = {x=x, y=y, z=z, stackPos=253}
                    local getCreatures = getTopCreature(explode).uid
                        setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
                        setPlayerStorageValue(target, cfg.kills, 0) -- reseting kill streak because you died.
                        doSendMagicEffect(explode, cfg.explodeEffect)
                        if isCreature(getCreatures) then
                            doCreatureAddHealth(getCreatures, -cfg.explodeDamage)
                        end
                    end
                end
            end
        else
            setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
            setPlayerStorageValue(target, cfg.kills, 0) -- reseting kill streak because you died.
        end
    end
return true
end
Gonna combine it to a mod when it's finished, that's why there's some other stuff in the cfg, just dont mind that ;p
 
I tested like this instead;
Code:
local kstreak = {
        [COLOR=Red][1] =[/COLOR] {kills = 2, msg = "Double Kill!"},
        [COLOR=Red][2] =[/COLOR] {kills = 3, msg = "Triple Kill!"},
        [COLOR=Red][4] =[/COLOR] {kills = 4, msg = "Quad Kill!"},
        [COLOR=Red][5] =[/COLOR] {kills = 5, msg = "M-M-M-Monster Kill!!"},
        [COLOR=Red][6] =[/COLOR] {kills = 6, msg = "BLOODBATH!"},
        [COLOR=Red][7] =[/COLOR] {kills = 7, msg = "UNSTOPPABLE!"},
   [COLOR=Red]     [8] =[/COLOR] {kills = 8, msg = "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
    local dstreak = {
       [COLOR=Red] [1] [/COLOR]= {deaths = 2, msg = "on a death streak of 2 deaths in a row!"},
       [COLOR=Red] [2][/COLOR] = {deaths = 3, msg = "on a death streak of 3 deaths in a row!"},
      [COLOR=Red]  [3][/COLOR] = {deaths = 4, msg = "on a death streak of 4 deaths in a row!"},
      [COLOR=Red]  [4][/COLOR] = {deaths = 5, msg = "on a death streak of 5 deaths in a row!"},
       [COLOR=Red] [5][/COLOR] = {deaths = 6, msg = "on a death streak of 6 or more deaths in a row!"}} -- Will be sent when you got this much deaths or more.

function onKill(cid, target, lastHit)
    -- for k = kstreak[1], kstreak[math.max(1, #kstreak)] do
        -- for d = dstreak[1], dstreak[math.max(1, #dstreak)] do
    [COLOR=Red]for k = kstreak[1], kstreak[#kstreak] do
        for d = dstreak[1], dstreak[#dstreak] do[/COLOR]
            local vk = kstreak[#kstreak]
            local vd = dstreak[#dstreak]

            if getPlayerStorageValue(cid, cfg.kills) == vk.kills then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. vk.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            elseif getPlayerStorageValue(cid, cfg.kills) > k.kills then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " - " .. k.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            end
            if getPlayerStorageValue(target, cfg.deaths) == vd.deaths then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. vd.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            elseif getPlayerStorageValue(target, cfg.deaths) > d.deaths then
                for _, tid in ipairs(getOnlinePlayers()) do
                    doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " - " .. d.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                end
            end
        --end
    --end

    if isPlayer(cid) then
        setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
        setPlayerStorageValue(cid, cfg.deaths, 0) -- reseting death streak because you killed someone.
        if cfg.useReplenish then
            if getPlayerStorageValue(cid, cfg.kills) >= cfg.replenish_reqKills and getPlayerStorageValue(cid, cfg.replenish_alreadyGiven) ~= 1 then
                setPlayerStorageValue(cid, cfg.replenish_chargeStorage, cfg.replenish_charges)
                setPlayerStorageValue(cid, cfg.replenish_alreadyGiven, 1)
            end
        end
        if cfg.useImmortality then
            if getPlayerStorageValue(cid, cfg.kills) >= cfg.immortal_reqKills and getPlayerStorageValue(cid, cfg.immortal_alreadyGiven) ~= 1 then
                setPlayerStorageValue(cid, cfg.immortal_chargeStorage, cfg.immortal_charges)
                setPlayerStorageValue(cid, cfg.immortal_alreadyGiven, 1)
            end
        end
        if cfg.useInvisibility then
            if getPlayerStorageValue(cid, cfg.kills) >= cfg.invisible_reqKills and getPlayerStorageValue(cid, cfg.invisible_alreadyGiven) ~= 1 then
                setPlayerStorageValue(cid, cfg.invisible_cargeStorage, cfg.invisible_charges)
                setPlayerStorageValue(cid, cfg.invisible_alreadyGiven, 1)
            end
        end
    end
    if isPlayer(target) then
        if cfg.useExplodeOnDeath and getPlayerStorageValue(target, cfg.kills) >= cfg.killsToExplode then
            local fromPos = {getPlayerPosition(target).x-cfg.bomb_area[1], getPlayerPosition(target).y-cfg.bomb_area[2], getPlayerPosition(target).z}
            local toPos = {getPlayerPosition(target).x+cfg.bomb_area[1], getPlayerPosition(target).y+cfg.bomb_area[2], getPlayerPosition(target).z}
            for x = fromPos[1], toPos[1] do
                for y = fromPos[2], toPos[2] do
                    for z = fromPos[3], toPos[3] do
                    local explode = {x=x, y=y, z=z, stackPos=253}
                    local getCreatures = getTopCreature(explode).uid
                        setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
                        setPlayerStorageValue(target, cfg.kills, 0) -- reseting kill streak because you died.
                        doSendMagicEffect(explode, cfg.explodeEffect)
                        if isCreature(getCreatures) then
                            doCreatureAddHealth(getCreatures, -cfg.explodeDamage)
                        end
                    end
                end
            end
        else
            setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
            setPlayerStorageValue(target, cfg.kills, 0) -- reseting kill streak because you died.
        end
    end
return true
end
And now I don't get any errors in the console, and it doesn't broadcast in the kill streak channel, nor giving me any storages ;s
Code:
16:41  [Testing - 1000] = 0
 
i think if he missed to place an 'end' anywhere the script would have failed to launch and the error would have been different.
In that script you are missing two ends and they are supposed to be before the 'if isPlayer(cid) then'(which are there, but they are dashed, so it does not count), those are to close 'for k' and 'for d', those count as 'if' statements and they need to be closed.
 
Last edited:
K tested like this now!
Code:
    local kstreak = {
        count = 7, -- How many different messages there is for kill streaks
        {kills = 2, msg = "Double Kill!"},
        {kills = 3, msg = "Triple Kill!"},
        {kills = 4, msg = "Quad Kill!"},
        {kills = 5, msg = "M-M-M-Monster Kill!!"},
        {kills = 6, msg = "BLOODBATH!"},
        {kills = 7, msg = "UNSTOPPABLE!"},
        {kills = 8, msg = "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
    local dstreak = {
        count = 5, -- How many different messages there is for death streaks
        {deaths = 2, msg = "on a death streak of 2 deaths in a row!"},
        {deaths = 3, msg = "on a death streak of 3 deaths in a row!"},
        {deaths = 4, msg = "on a death streak of 4 deaths in a row!"},
        {deaths = 5, msg = "on a death streak of 5 deaths in a row!"},
        {deaths = 6, msg = "on a death streak of 6 or more deaths in a row!"}} -- Will be sent when you got this much deaths or more.
        
function onKill(cid, target, lastHit)
    for _, tid in ipairs(getPlayersOnline()) do
        for k = 1, kstreak.count do
            for d = 1, dstreak.count do
                if isPlayer(target) then
                    setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
                    setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
                    setPlayerStorageValue(cid, cfg.deaths, 0)
                    setPlayerStorageValue(target, cfg.kills, 0)
                    if getPlayerStorageValue(cid, cfg.kills) == kstreak[k].kills then
                        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [".. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kstreak[k].msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    -- elseif getPlayerStorageValue(cid, cfg.kills) > kstreak[kstreak.count].kills then
                        -- doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [" .. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kstreak[#kstreak].msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    end
                end
            end
        end
    end
return true
end
but when this part is like this, in red it doesn't broadcast anything in the channel
Code:
if getPlayerStorageValue(cid, cfg.kills) [COLOR=Red]==[/COLOR] kstreak[k].kills then
but if i change to
Code:
if getPlayerStorageValue(cid, cfg.kills) [COLOR=Red]>=[/COLOR] kstreak[k].kills then
then it broadcast in the channel but it broadcasts ALL the kill msges and does it 3 times;
Test [10] got eliminated by Test two [15] - Double kill
Test [10] got eliminated by Test two [15] - Double kill
Test [10] got eliminated by Test two [15] - Double kill
Test [10] got eliminated by Test two [15] - Triple kill
Test [10] got eliminated by Test two [15] - Triple kill
Test [10] got eliminated by Test two [15] - Triple kill
Test [10] got eliminated by Test two [15] - Quad kill
Test [10] got eliminated by Test two [15] - Quad kill
Test [10] got eliminated by Test two [15] - Quad kill
..
....
....
and so on

Just dont care about the commented stuff ;p
 
do the rest urself, i cant even understand wat ur trying to do:
Code:
local resetStreaksOnLogin, kills, deaths, channel =
	true, 1000, 1001, 10

local explode = {
	use = true,
	effect = CONST_ME_FIREATTACK,
	damage = 500,
	kills = 5,
	area = {5, 5}
}
local Replenish = {
	use = true,
	health = math.random(350, 700),
	mana = math.random(250, 550),
	cooldown = 40,
	charges = 5,
	req = 7,
	storage = 1002,
	given = 1003,
	coolDown = 1004
}
local Immortality = {
	use = true,
	bc = true,
	effect = true,
	eff = CONST_ME_HOLYAREA,
	req = 10,
	time = 25,
	coolDown = 240,
	charges = 2,
	storage = 1005,
	given = 1006,
	coolDown = 1008
}
local Invisibilty = {
	use = true,
	bc = true,
	kills = 10,
	time = 25,
	coolDown = 180,
	stime = 1009,
	charges = 1010,
	given = 1011,
	coolDown = 1012,
	active = 1013
}

local killStreak = {
	[2] = {"Double kill"},
	[3] = {"Triple Kill"},
	[4] = {"Quad Kill"},
	[5] = {"M-M-M-Monster Kill!!"},
	[6] = {"BLOODBATH!"},
	[7] = {"UNSTOPPABLE!"},
	[8] = {"GODLIKE!!"}
}
local deathStreak = {2, 6}

function onKill(cid, target, lastHit)
	for s, e in pairs(killStreak) do
		if getPlayerStorageValue(cid, kills) >= s then
			setPlayerStorageValue(cid, kills, getPlayerStorageValue(cid, kills)+1)
			for _, v in ipairs(getPlayersOnline()) do
				doPlayerSendChannelMessage(v, "Streaks", getCreatureName(cid) .. " - " .. e, TALKTYPE_CHANNEL_O, channel)
			end
		end
	end
	return true
end
 
Doesn't give me storage ;S


I'll try explain what it should do:
When you kill a player the script will broadcast in a channel(11)
You will get +1 in the kill value every time you kill someone

The broadcast will broadcast different depending on how many kills you have(Double kill, triple kill and so on)

If you die your kill storage will get reseted to 0 and you will get a death storage value +1 and it will also broadcast different depending on how many times he/she died in a row.

The last message in the kill streak and death streak will be broadcasted every time you kill someone or die if you have the kill/death value over the last one(can't really explain, hope you get that)

everything else I can fix myself ;p
 
i don't know if it will work but try this:
Lua:
local kstreak = {
        [2] = {msg = "Double Kill!"},
        [3] = {msg = "Triple Kill!"},
        [4] = {msg = "Quad Kill!"},
        [5] = {msg = "M-M-M-Monster Kill!!"},
        [6] = {msg = "BLOODBATH!"},
        [7] = {msg = "UNSTOPPABLE!"},
        [8] = {msg = "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
    local dstreak = {
        [2] = {msg = "on a death streak of 2 deaths in a row!"},
        [3] = {msg = "on a death streak of 3 deaths in a row!"},
        [4] = {msg = "on a death streak of 4 deaths in a row!"},
        [5] = {msg = "on a death streak of 5 deaths in a row!"},
        [6] = {msg = "on a death streak of 6 or more deaths in a row!"}} -- Will be sent when you got this much deaths or more.
    
function onKill(cid, target, lastHit)
    for _, tid in ipairs(getPlayersOnline()) do
	for k, kv in pairs(kstreak) do    
	    for d, dv in pairs(dstreak) do
		local kill = k
		local death = d
                if isPlayer(target) then
                    setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
                    setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)
                    setPlayerStorageValue(cid, cfg.deaths, 0)
                    setPlayerStorageValue(target, cfg.kills, 0)
                    if getPlayerStorageValue(cid, cfg.kills) == kill then
                        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [".. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kv.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    -- elseif getPlayerStorageValue(cid, cfg.kills) > kstreak[kstreak.count].kills then
                        -- doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [" .. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kstreak[#kstreak].msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    end
                end
            end
        end
    end
return true
end
 
Last edited:
Didn't broadcast anything and gave me + 105 in storagevalue when I killed someone ;p
my script gave me + 105 storage value too, and broadcasting 105 times too I guess;s

No errors
 
here try this: i only made a very small change in the setstorage : i think that you are setting a big value when you do
'setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)' and
'setPlayerStorageValue(target, cfg.deaths, getPlayerStorageValue(target, cfg.deaths)+1)', and i wouldn't broadcast anything because the value is bigger then the ones specified, it will only end.
Lua:
local kstreak = {
        [2] = {msg = "Double Kill!"},
        [3] = {msg = "Triple Kill!"},
        [4] = {msg = "Quad Kill!"},
        [5] = {msg = "M-M-M-Monster Kill!!"},
        [6] = {msg = "BLOODBATH!"},
        [7] = {msg = "UNSTOPPABLE!"},
        [8] = {msg = "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
    local dstreak = {
        [2] = {msg = "on a death streak of 2 deaths in a row!"},
        [3] = {msg = "on a death streak of 3 deaths in a row!"},
        [4] = {msg = "on a death streak of 4 deaths in a row!"},
        [5] = {msg = "on a death streak of 5 deaths in a row!"},
        [6] = {msg = "on a death streak of 6 or more deaths in a row!"}} -- Will be sent when you got this much deaths or more.
    
function onKill(cid, target, lastHit)
    for _, tid in ipairs(getPlayersOnline()) do
	for k, kv in pairs(kstreak) do    
	    for d, dv in pairs(dstreak) do
		local kill = k
		local death = d
                if isPlayer(target) then
                    setPlayerStorageValue(cid, cfg.kills, +1)
                    setPlayerStorageValue(target, cfg.deaths, +1)
                    setPlayerStorageValue(cid, cfg.deaths, 0)
                    setPlayerStorageValue(target, cfg.kills, 0)
                    if getPlayerStorageValue(cid, cfg.kills) == kill then
                        doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [".. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kv.msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    -- elseif getPlayerStorageValue(cid, cfg.kills) > kstreak[kstreak.count].kills then
                        -- doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [" .. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kstreak[#kstreak].msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    end
                end
            end
        end
    end
return true
end
 
Last edited:
aaaa ok i see but how is it that its giving you +105 on the value? is there any other script that is setting that value? verify that. or probably that storage key is in use by another script, also try manually setting your character's storage value to 0, and try it
 
Try using a different key storage and set that storage value to 0, idk try 35000 as the key and 0 as the value and see. it can be done easily because you made a 'cfg' .
 
woah and it did not broadcast anything??
well anyways try this and tel me what it broadcasts:
Lua:
local kstreak = {
        [2] = {msg = "Double Kill!"},
        [3] = {msg = "Triple Kill!"},
        [4] = {msg = "Quad Kill!"},
        [5] = {msg = "M-M-M-Monster Kill!!"},
        [6] = {msg = "BLOODBATH!"},
        [7] = {msg = "UNSTOPPABLE!"},
        [8] = {msg = "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
local dstreak = {
        [2] = {msg = "on a death streak of 2 deaths in a row!"},
        [3] = {msg = "on a death streak of 3 deaths in a row!"},
        [4] = {msg = "on a death streak of 4 deaths in a row!"},
        [5] = {msg = "on a death streak of 5 deaths in a row!"},
        [6] = {msg = "on a death streak of 6 or more deaths in a row!"}} -- Will be sent when you got this much deaths or more.
function onKill(cid, target, lastHit)
	for _, tid in ipairs(getPlayersOnline()) do
		for k, kv in pairs(kstreak) do    
			for d, dv in pairs(dstreak) do
			local kill = k
			local death = d
				if isPlayer(target) then
					setPlayerStorageValue(cid, cfg.kills, +1)
					setPlayerStorageValue(target, cfg.deaths, +1)
					setPlayerStorageValue(cid, cfg.deaths, 0)
					setPlayerStorageValue(target, cfg.kills, 0)
					if getPlayerStorageValue(cid, cfg.kills) == kill then
						doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [".. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kv.msg, TALKTYPE_CHANNEL_O, cfg.channel)
					elseif getPlayerStorageValue(cid, cfg.kills) >= 8 then
						doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [".. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kv.msg, TALKTYPE_CHANNEL_O, cfg.channel)	
                    -- elseif getPlayerStorageValue(cid, cfg.kills) > kstreak[kstreak.count].kills then
                        -- doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [" .. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kstreak[#kstreak].msg, TALKTYPE_CHANNEL_O, cfg.channel)
                    end
                end
            end
        end
    end
return true
end
 
Last edited:
k I solved the problem;
Code:
    local kstreak = {
        lastKills = 8, -- How many kills you need for the last message
    -- [kills]= {kills, "Message"} -- Yes kills two times..
        [2] = {2, "Double Kill!"},
        [3] = {3, "Triple Kill!"},
        [4] = {4, "Quad Kill!", ""},
        [5] = {5, "M-M-M-Monster Kill!!"},
        [6] = {6, "BLOODBATH!"},
        [7] = {7, "UNSTOPPABLE!"},
        [8] = {8, "GODLIKE!!"}} -- Will be sent if you got this much kills or more.
        
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isPlayer(target) then
        setPlayerStorageValue(cid, cfg.kills, getPlayerStorageValue(cid, cfg.kills)+1)
        setPlayerStorageValue(cid, cfg.deaths, 0)
        for _, tid in ipairs(getPlayersOnline()) do
            local k = kstreak[getPlayerStorageValue(cid, cfg.kills)]
            if getPlayerStorageValue(cid, cfg.kills) > kstreak.lastKills then
                local msg = kstreak[getPlayerStorageValue(cid, cfg.kills)]
                doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [" .. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. kstreak[kstreak.lastKills][2], TALKTYPE_CHANNEL_O, cfg.channel)
            elseif getPlayerStorageValue(cid, cfg.kills) == k[1] and getPlayerStorageValue(cid, cfg.kills) <= kstreak.lastKills then
                local msg = kstreak[getPlayerStorageValue(cid, cfg.kills)]
                doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(target) .. " [".. getPlayerLevel(target) .. "] got eliminated by " .. getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "] - " .. msg[2], TALKTYPE_CHANNEL_O, cfg.channel)
            end
        end
    end
return true
end
Now I'll just fix everything else and release it ;D
 
nice even that looks like it works better then how i made mine, also did you make another stating on what it will do after you get 8 kills, because for what i read from this script is, that once it gets to 8 kills it will just 'end' on that last 'elseif' statement.
EDIT: Opps I didn't read well the first one above the 'elseif', hahaha, way better than before. Hope to see the release soon.
 
Back
Top