#Announce Killstreak Every 5 kills

1 messages · Page 1 of 1 (latest)

crisp swallow
#

I have this code to announce when a player reaches a killstreak of 5, 10, 15 ect but it broadcasts every 1 kill. Its not the most efficienct code, but how can I fix it?

```on join:
 if {streak::%player's uuid%} is not set:
  set {streak::%player's uuid%} to 0
     
on death:
 if attacker is a player:
  if victim is a player:
   if {streak::%attacker's uuid%} = {killstreak::%attacker's uuid%} / 5:
    add 1 to {killstreak::%attacker's uuid%}
    set {killstreak::%victim's uuid%} to 0
    add 0.2 to {streak::%attacker's uuid%}
    set {streak::%victim's uuid%} to 0
    broadcast "&f%attacker% has reached a streak of %{killstreak::%attacker's uuid%}%"
   else:
    add 1 to {killstreak::%attacker's uuid%}
    set {killstreak::%victim's uuid%} to 0
    add 0.2 to {streak::%attacker's uuid%}
    set {streak::%victim's uuid%} to 0

on death:
 if attacker is a player:
  if victim is a player:
   if attacker has permission "killtokens.double":
    give attacker 2 of red dye named "&4&lKill token"
   else:
    give attacker 1 of red dye named "&4&lKill token"

on join:
 if {killstreak::%player's uuid%} is not set:
  set {killstreak::%player's uuid%} to 0```
#

(the purpose of streak was to check if the player has 5 kills they should have 1 streak but I realised if u had 6 kills u would have 1.2 streak so it wouldnt work)

crisp swallow
#

Anyone?

cedar hemlock
#

steak??

#

😭

crisp swallow
#

I know xD

cedar hemlock
#

is that intentional

crisp swallow
#

Don’t mind the misspelling , doesn’t work even if it’s spelled correctly

#

Naw

cedar hemlock
#

yeah it would

#

review line 8

crisp swallow
#

No it wouldn’t I have tested it with the correct spelling

cedar hemlock
#

why do you have 2 variables for killstreak?

crisp swallow
#

I was gonna make it so every 5 kill streak is 1 streak which would be used to know when a player reaches 5 or 10 or 15 etc kill streak but I realised I can also do 1.2 x 5 etc

cedar hemlock
crisp swallow
#

But it always is

#

So

limpid hare
#

don't use two diff variables for the same thing

#

waste of space

#

tf is if {streak::%attacker's uuid%} = {killstreak::%attacker's uuid%} / 5: supposed to achieve exactly

#

it'll never fail

limpid hare
#

skquery's if X is divisible by 5 or skript's mod(X, 5) = 0

crisp swallow
#

so that will work?

limpid hare
#

if you use it right

crisp swallow
#

so like

#

mod(X, {killstreak::%player's uuid%}) = 1

limpid hare
#

arg-1 = thing you're checking

#

arg-2 = thing you're trying to divide it by

#

ex. mod(10, 2) = 0, because 10 is divisible by 2

#

mod(1, 2) = 1, because 1 is not divisible by 2, and has a remainder of 1

crisp swallow
#

so if it was mod(6, {killstreak::%player's uuid%}) = 6 and it wouldnt run?

#

what

#

I dont understand

fathom lion
crisp swallow
#

no.

#

I meant every 5 kills it announces killstreak

#

and when the player dies the killstreak is reset

fathom lion
#

okay

grim mirage
#

right?

crisp swallow
#

which is what I am trying to do

#

would Mod({killstreak::%player's uuid%}, 2) = 0 work

grim mirage
#

so if you do that with 5, it should work

crisp swallow
#

oh

#

so Mod({killstreak::%player's uuid%}, 5) = 0

#

like

grim mirage
crisp swallow
#
 if attacker is a player:
  if Mod({killstreak::%player's uuid%}, 5) = 0:
   broadcast "&fPlayer has reached a killstreak of %{killstreak::%player's uuid%}"```
grim mirage
#

ye

crisp swallow
#

in skunity parser it says otherwise though'

grim mirage
#

your missing a % at the

#

end

crisp swallow
#

wym

grim mirage
#

functions are case sensitive i believe

#

mod should be all lowercase

crisp swallow
#

watt

#

no errors

#

how am I suppost to figure that out

#

weird

#

ty xD

umbral spoke
#

mod(a, b) = the remainder of a/b

crisp swallow
#

I managed to get it to work <:

#

(in skunity parser at least)

crisp swallow
#

Doesnt work

#

it doesnt broadcast the message

limpid hare
#

what's the code?

crisp swallow
#
 if attacker is a player:
  if mod({killstreak::%attacker's uuid%}, 5) = 1:
   broadcast "&fPlayer has reached a killstreak of %{killstreak::%attacker's uuid%}%"```
#

also tried

 if attacker is a player:
  if mod({killstreak::%attacker's uuid%}, 5) = 0:
   broadcast "&fPlayer has reached a killstreak of %{killstreak::%attacker's uuid%}%"```
#

(change is in end of 3rd line)

limpid hare
#

second one should work

crisp swallow
#

doesn't

limpid hare
#

is your killstreak divisible by 5?

#

are you killing a player to proc the event?

crisp swallow
#

if my killstreak is 5 then it should broadcast it

#

right?

limpid hare
#

yes

umbral spoke
#

They have mod() = 1