Can someone help me?

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

Mozuzu

Member
Mar 2, 2024
1
0
1
14
So i made this skript to notify players that someone is afk but the "if arg-1 is "(text)": doesnt work.

Heres the Skript:

command /imafk <Text>:
permission: op
permission message: &cError!
trigger:
if arg-1 is not set:
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
stop
if arg-1 is "stop":
send "&6%player% is back from his break!" to all players
stop

( sorry i dont know how to put it like in a code thing i also attached the file with the skript)
 

Attachments

  • afk.sk
    1.1 KB · Views: 15
When you have <> at your argument you have to set it, so just do [<text>]
 
So i made this skript to notify players that someone is afk but the "if arg-1 is "(text)": doesnt work.

Heres the Skript:

command /imafk <Text>:
permission: op
permission message: &cError!
trigger:
if arg-1 is not set:
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
wait 1200 ticks
send "&c[&eNotice&c] &a%player% is AFK right now!" to all players
stop
if arg-1 is "stop":
send "&6%player% is back from his break!" to all players
stop

( sorry i dont know how to put it like in a code thing i also attached the file with the skript)
Just make somethig like EssentialsX has. So that way players can just use /afk to toggle ON/OFF the afk. Like this.


Code:
on connect:
    set {afk.skript::%player's uuid%} to 0

command /afk:
    trigger:
        if {afk.skript::%player's uuid%} is set:
            if {afk.skript::%player's uuid%} is 0:
                set {afk.skript::%player's uuid%} to 1
                broadcast "&7%player% is now afk."
            else if {afk.skript::%player's uuid%} is 1:
                set {afk.skript::%player's uuid%} to 0
                broadcast "&7%player% came back."
        else if {afk.skript::%player's uuid%} is not set:
            send "&cSorry, something had went wrong with connections, please try rejoining the server." to player

Addinions

If player tries to damage the afk player of the afk player tries to damage other player, it cancels the damage until player moves as given in the next additionalk code.
Code:
on damage:
    if {afk.skript::%victim's uuid%} is set:
        if {afk.skript::%victim's uuid%} is 1:
            cancel event
    else if {afk.skript::%attacker's uuid%} is set:
        if {afk.skript::%attacker's uuid%} is 1:
            cancel event

This one is if player moves it makes the player "not afk"
Code:
on player move:
    if {afk.skript::%player's uuid%} is set:
        if {afk.skript::%player's uuid%} is 1:
            set {afk.skript::%player's uuid%} to 0
            broadcast "&7%player% came back."

Hope you like it.
 
Last edited: