Solved Can we use "@" as a command?

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

Status
Not open for further replies.

IxtraDeath

Member
Feb 23, 2017
16
0
0
25
Helllo

I have a little question, can we use @ or other symbols to run commands?

Like:

When a player chat:

Ixtradeath: @Hey
# Canel chat event then runs a command like /staffchat Hey or /global hey
 
Try it out by yourself
it's called the skunity docs
there is no need to be rude, you could just tell the guy how do it without spoon feeding him. What a shame that skUnity has this kind of helpers nowdays.

Now, regarding to the OP's issue, you need listen to the chat event and then check if the first character of the message is "@" ( or yet better, parse the message as "@%text%[ %text%]") and then do whatever you want to do.
 
  • Like
Reactions: IxtraDeath
there is no need to be rude, you could just tell the guy how do it without spoon feeding him. What a shame that skUnity has this kind of helpers nowdays.

Now, regarding to the OP's issue, you need listen to the chat event and then check if the first character of the message is "@" ( or yet better, parse the message as "@%text%[ %text%]") and then do whatever you want to do.

finally someone who can actually help, other the "good for nothing" above

Thanks. will try that :emoji_slight_smile:
 
there is no need to be rude, you could just tell the guy how do it without spoon feeding him. What a shame that skUnity has this kind of helpers nowdays.

Now, regarding to the OP's issue, you need listen to the chat event and then check if the first character of the message is "@" ( or yet better, parse the message as "@%text%[ %text%]") and then do whatever you want to do.
No, it may come off as rude but you can't disagree 95% of people on here don't try and look for stuff before asking
 
Code:
code_language.skript:
on chat:
    if the first 1 characters of message is "@":
        cancel event
        set {Split.Message.%player%::*} to message split at "@"
        loop {Split.Message.%player%::*}:
            set {Split.Message.Send.%player%::*} to "%loop-var%"
        broadcast "&4%player% &8: &c%{Split.Message.Send.%player%::*}%"
 
  • Like
Reactions: IxtraDeath
Code:
code_language.skript:
on chat:
    if the first 1 characters of message is "@":
        cancel event
        set {Split.Message.%player%::*} to message split at "@"
        loop {Split.Message.%player%::*}:
            set {Split.Message.Send.%player%::*} to "%loop-var%"
        broadcast "&4%player% &8: &c%{Split.Message.Send.%player%::*}%"

That worked, thanks
 
Status
Not open for further replies.