Problem with Personal and Serverwide boosters

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Vini

Member
Apr 8, 2023
27
2
3
24
Hey!
So I have this skript:
# {type.booster.%player's uuid%} = Booster Type
# {active.booster.%player's uuid%} = Booster active or not
# {time.booster.%player's uuid%} = Time left on booster

command boostergive <integer> [<player>]:
aliases: /bgive
permission: op
trigger:
if arg-1 is 2, 5, 10, 20 or 30:
if arg-2 is not set:
give player 1 orange dye named "&b%arg-1%x &eBooster &f| &b5 minutes"
else:
give arg-2 1 orange dye named "&b%arg-1%x &eBooster &f| &b5 minutes"
else:
send "&6&lBOOSTER &8» &c[ERROR] &fUnknown booster integer."
command booster:
trigger:
if {active.booster.%player's uuid%} is true:
send "&6&lBOOSTER &8» &fYou have a booster active: &b%{type.booster.%player's uuid%}%&fx Booster, &b%{time.booster.%player's uuid%}% &fminutes remaining."
else:
send "&6&lBOOSTER &8» &fYou do not have a booster active."
on rightclick with orange dye:
if {active.booster.%player's uuid%} is true:
send "&6&lBOOSTER &8» &c[ERROR] &fYour &b%{type.booster.%player's uuid%}%&fx Booster is already active. &b%{time.booster.%player's uuid%}% &fminutes remaining until you can use another one."
else:
if name of player's tool is "&b2x &eBooster &f| &b5 minutes":
set {type.booster.%player's uuid%} to 2
else if name of player's tool is "&b5x &eBooster &f| &b5 minutes":
set {type.booster.%player's uuid%} to 5
else if name of player's tool is "&b10x &eBooster &f| &b5 minutes":
set {type.booster.%player's uuid%} to 10
else if name of player's tool is "&b20x &eBooster &f| &b5 minutes":
set {type.booster.%player's uuid%} to 20
else if name of player's tool is "&b30x &eBooster &f| &b5 minutes":
set {type.booster.%player's uuid%} to 30
else:
stop
remove 1 orange dye named "&b%{type.booster.%player's uuid%}%x &eBooster &f| &b5 minutes" from player
set {active.booster.%player's uuid%} to true
set {time.booster.%player's uuid%} to 5
send "&6&lBOOSTER &8» &fYou enabled your booster! &b%{time.booster.%player's uuid%}% &fminutes remaining."
while {time.booster.%player's uuid%} is more than 0:
wait 1 minute
remove 1 from {time.booster.%player's uuid%}
send "&6&lBOOSTER &8» &b%{time.booster.%player's uuid%}% &fminute(s) remaining on your booster."
set {active.booster.%player's uuid%} to false
clear {type.booster.%player's uuid%}
send "&6&lBOOSTER &8» &fYour booster period is now over."
The problem is that these only work for 1 player, the player who activated it, so I want it to work for everyone on the server if one player activated it.
How should I try to do that or how do I do thats?
Pls help and note that I'm a starter skripter and don't know much about skript and need help and I don't understand most of the things you write in "skripter language" or whatever
Thanks, Vini!
 
Sorry, I just realised that I pasted it incorrectly

Code:
# {type.booster.%player's uuid%} = Booster Type
# {active.booster.%player's uuid%} = Booster active or not
# {time.booster.%player's uuid%} = Time left on booster

command boostergive <integer> [<player>]:
    aliases: /bgive
    permission: op
    trigger:
        if arg-1 is 2, 5, 10, 20 or 30:
            if arg-2 is not set:
                give player 1 orange dye named "&b%arg-1%x &eBooster &f| &b5 minutes"
            else:
                give arg-2 1 orange dye named "&b%arg-1%x &eBooster &f| &b5 minutes"
        else:
            send "&6&lBOOSTER &8» &c[ERROR] &fUnknown booster integer."
command booster:
    trigger:
        if {active.booster.%player's uuid%} is true:
            send "&6&lBOOSTER &8» &fYou have a booster active: &b%{type.booster.%player's uuid%}%&fx Booster, &b%{time.booster.%player's uuid%}% &fminutes remaining."
        else:
            send "&6&lBOOSTER &8» &fYou do not have a booster active."
on rightclick with orange dye:
    if {active.booster.%player's uuid%} is true:
        send "&6&lBOOSTER &8» &c[ERROR] &fYour &b%{type.booster.%player's uuid%}%&fx Booster is already active. &b%{time.booster.%player's uuid%}% &fminutes remaining until you can use another one."
    else:
        if name of player's tool is "&b2x &eBooster &f| &b5 minutes":
            set {type.booster.%player's uuid%} to 2
        else if name of player's tool is "&b5x &eBooster &f| &b5 minutes":
            set {type.booster.%player's uuid%} to 5
        else if name of player's tool is "&b10x &eBooster &f| &b5 minutes":
            set {type.booster.%player's uuid%} to 10
        else if name of player's tool is "&b20x &eBooster &f| &b5 minutes":
            set {type.booster.%player's uuid%} to 20
        else if name of player's tool is "&b30x &eBooster &f| &b5 minutes":
            set {type.booster.%player's uuid%} to 30
        else:
            stop
        remove 1 orange dye named "&b%{type.booster.%player's uuid%}%x &eBooster &f| &b5 minutes" from player
        set {active.booster.%player's uuid%} to true
        set {time.booster.%player's uuid%} to 5
        send "&6&lBOOSTER &8» &fYou enabled your booster! &b%{time.booster.%player's uuid%}% &fminutes remaining."
        while {time.booster.%player's uuid%} is more than 0:
            wait 1 minute
            remove 1 from {time.booster.%player's uuid%}
            send "&6&lBOOSTER &8» &b%{time.booster.%player's uuid%}% &fminute(s) remaining on your booster."
        set {active.booster.%player's uuid%} to false
        clear {type.booster.%player's uuid%}
        send "&6&lBOOSTER &8» &fYour booster period is now over."
 
The issue you have is that your boost variable is not a list variable. This means you cannot select every player that has a boost variable assigned to them at once and thus cannot enable a boost for everyone. When you use a list variable, it stores the data that your decide to put in it (In your case; a boost assigned to a player's uuid) into a list which you can retrieve.

By adding a star like seen below, you can select the entire list and change its value:
Code:
on first join:
set {exam::%player's uuid%} to 0

command viewexam:
   trigger:
      send "Example variable's value is %{exam::%player's uuid%}%" to player

command setexam [<number>]:
   trigger:
      set {exam::*} to arg-1
      send "Success! Now everyone player who has joined now has an example variable value of %arg-1%" to player
 
The issue you have is that your boost variable is not a list variable. This means you cannot select every player that has a boost variable assigned to them at once and thus cannot enable a boost for everyone. When you use a list variable, it stores the data that your decide to put in it (In your case; a boost assigned to a player's uuid) into a list which you can retrieve.

By adding a star like seen below, you can select the entire list and change its value:
Code:
on first join:
set {exam::%player's uuid%} to 0

command viewexam:
   trigger:
      send "Example variable's value is %{exam::%player's uuid%}%" to player

command setexam [<number>]:
   trigger:
      set {exam::*} to arg-1
      send "Success! Now everyone player who has joined now has an example variable value of %arg-1%" to player
Sorry but I can't undarstand what you just said, can you explain it better? maybe even change a line in my skript so I can see how it is.
 
Sorry but I can't undarstand what you just said, can you explain it better? maybe even change a line in my skript so I can see how it is.
I mean I kinda get it but idk where I have to use it
 
I mean I kinda get it but idk where I have to use it
Instead of using a var like "{active.booster.%player's uuid%}" which would only be for the targeted player; you would change it to {active.booster::*}. You would also change the original var (If a player joins and you wanna set it to a default value) to "{active.booster::%player's uuid%}". List values I think are a lot better for storing & saving information like for boosters/currency/etc. Then to retrieve the entire list (And every player attached to it); you replace %player's uuid% with a single asterisk.
 
Instead of using a var like "{active.booster.%player's uuid%}" which would only be for the targeted player; you would change it to {active.booster::*}. You would also change the original var (If a player joins and you wanna set it to a default value) to "{active.booster::%player's uuid%}". List values I think are a lot better for storing & saving information like for boosters/currency/etc. Then to retrieve the entire list (And every player attached to it); you replace %player's uuid% with a single asterisk.
Thank you so much for helping! I still need to test this tho.
 
  • Like
Reactions: Luke_Sky_Walker
Instead of using a var like "{active.booster.%player's uuid%}" which would only be for the targeted player; you would change it to {active.booster::*}. You would also change the original var (If a player joins and you wanna set it to a default value) to "{active.booster::%player's uuid%}". List values I think are a lot better for storing & saving information like for boosters/currency/etc. Then to retrieve the entire list (And every player attached to it); you replace %player's uuid% with a single asterisk.
Do I also change any %player's uuid% variable or only the ctive booster one?
 
Do I also change any %player's uuid% variable or only the ctive booster one?
You would change the one that you'd want to be a Global thing with the asterisk. If you'd want it to affect every player; make sure that the ".%player's uuid}" variable portion of your code is replaced with "::%player's uuid%" to make it a list variable that you can easily change (This can also be helpful for resetting all players booster variables simultaneously if needed).
 
You would change the one that you'd want to be a Global thing with the asterisk. If you'd want it to affect every player; make sure that the ".%player's uuid}" variable portion of your code is replaced with "::%player's uuid%" to make it a list variable that you can easily change (This can also be helpful for resetting all players booster variables simultaneously if needed).
"::emoji_stuck_out_tongue:layer's uuid"? not "::*"?
 
You would change the one that you'd want to be a Global thing with the asterisk. If you'd want it to affect every player; make sure that the ".%player's uuid}" variable portion of your code is replaced with "::%player's uuid%" to make it a list variable that you can easily change (This can also be helpful for resetting all players booster variables simultaneously if needed).
hmm, Isn't global and every player the same thing?
 
Yeah, pretty much.
then why did you say: "You would change the one that you'd want to be a Global thing with the asterisk. If you'd want it to affect every player; make sure that the ".%player's uuid}" variable portion of your code is replaced with "::%player's uuid%""? Did I understand something wrongly?
 
then why did you say: "You would change the one that you'd want to be a Global thing with the asterisk. If you'd want it to affect every player; make sure that the ".%player's uuid}" variable portion of your code is replaced with "::%player's uuid%""? Did I understand something wrongly?
Sorry, I typed that wrong. For the second portion I typed I meant if you had wanted it to affect a singular player. Apologies for the typo.
 
N

No problem; hope that helps!
How do I add it to here?

Code:
on break:
    set {fortune.%player's uuid%} to level of fortune of player's tool
    set {drops.%player's uuid%} to (1+{fortune.%player's uuid%})
    if {active.booster::*} is true:
        set {drops.%player's uuid%} to ({drops.%player's uuid%}*{type.booster.%player's uuid%})
    player's gamemode is survival
    if event-block is oak log:
        clear drops
        give player {drops.%player's uuid%} of oak log named "<##4B371C>Oak"
 
How do I add it to here?

Code:
on break:
    set {fortune.%player's uuid%} to level of fortune of player's tool
    set {drops.%player's uuid%} to (1+{fortune.%player's uuid%})
    if {active.booster::*} is true:
        set {drops.%player's uuid%} to ({drops.%player's uuid%}*{type.booster.%player's uuid%})
    player's gamemode is survival
    if event-block is oak log:
        clear drops
        give player {drops.%player's uuid%} of oak log named "<##4B371C>Oak"
In the break event, you would change the asterisk to the %player's uuid%. Changing the booster globally would look kinda like this:

Code:
command enableboost:
   permission: boost.admin
   trigger:
      set {active.booster::*} to "true" # Changes every boost for every player to "true". You could use a loop to make it only affect only online players
      # Add another other num/values needed to make a boost work for a player here