#detect chat
1 messages · Page 1 of 1 (latest)
use the chat event and check the message
https://skripthub.net/docs/?id=1005
https://skripthub.net/docs/?id=873
https://skripthub.net/docs/?id=2615
Called whenever a player chats. Use chat format to change message format, use chat recipients to edit chat recipients.
The (chat) message of a chat event, the join message of a join event, the quit message of a quit event, or the death message on a death event. This expression is mostly useful for being changed.
that worked
k
i just spelt my original one wrong bc im stupid
i put on chart: and somehow didnt notice
lol
is it possible to check for something in a message then (so if i was making a fake hack client, if someone types .give <any item>, it only detects the sencond part)
if message contains "":
but surely i would have to do that for every item name?
I mean u can prob store the items in a list
just get the second part, parse it as an item. and give it to the player
how do i just get the second part?
a really simple method would be:
on chat:
set {_} to message
if {_} starts with ".give ":
cancel event
replace all ".give " in {_} with ""
give 1 of {_} parsed as itemtype to player
something like that I'm on my phone
You're getting the 2nd part after replacing everything else before it with nothing, effectively leaving the 2nd part
If you wanted to make this more "dynamic" 💀 you could replace the ., split it at a space, then check what the first element is to see what the "command" that they're doing is
ill try that when im on my PC in a bit
Why does this not work (theres no errors):
set {_} to message
if {_} starts with ".enchant ":
cancel event
replace all ".enchant " in {_} with ""
enchant the player's tool with {_}
send "{@hax} Added enchantment of &l%{_}%&r!"
delete {_}```
you're enchanting it with a strong
String
also no need to delete a local variable
idk why i did that lmao
do i need to parse it somehow?
parsed as enchant type
no
remove the
no
enchant player's tool with {_} parsed as enchant type
yup
yes
is there a way i can make it so it allows .enchant <enchant> <level>
this is the code now:
if {_} starts with ".enchant ":
cancel event
replace all ".enchant " in {_} with ""
enchant player's tool with {_} parsed as enchantment type
send "{@hax} Added enchantment of &l%{_}%&r!"```
Yes there is
how?
command .enchant [<text>] [<int>]:
``` etc
that dosent work
So idk
