trying to get it to send to every one but player

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

    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!

timbercat10

Member
Jul 10, 2023
45
0
6
command afk:
trigger:
add 1 to {afkYN%player%}

if {afkYN%player%} is 1:
send "&b[boxcraft] &cyou are now afk" to player



if {afkYN%player%} is 2:
set {afkYN%player%} to 0


if {afkYN%player%} is 0:
send "&b[boxcraft] &ayou are no longer afk" to player
broadcast "&b[boxcraft] &a%player% is no longer afk" to "world"

variables:
{afkYN%player%} = 0
 
I would recommend setting the afk variable to a value like true/false and then checking that value while the player’s online. To send a message to all except the player, you can loop the player’s online and use an if else statement to check which message to send to who. So for instance (Note: This could have minor bugs/inconsistencies):

Code:
command afk:
   trigger:
      if {afkYN%player%} isn’t “true”:
         set {afkYN%player%} to true
         send “&b[Boxcraft] &cYou’re now AFK!” to player

every second:
  loop all players:
       if {afkYN%loop-player%} is “false”:
          send “&b[Boxcraft] &aYou’re no longer AFK!” To loop-player
          set {AFK} to loop-player
       else:
          send “&b[Boxcraft] &a%{AFK}% is no longer AFK!” To loop-player
 
Last edited: