Chat commands

By default, the chat provides a few commands:


  • /slowchat (on|off) - Will enable or disable slowchat for the current session.

  • /ban (Username) (Time) (Reason) - Bans a player. Time is in days.

  • /gms-kick (Username) - Kicks a player

  • /mute (Username) - Mutes a player for 5 minutes



You can add more commands by using gms_script_set_chat_verify, like this:

//Right after gms_settings

gms_script_set_chat_verify(scr_chat_verify)


In the script you receive the text the user just entered as argument0. You can use this text to pre-process the chat message before sending it. Finally the script should return true if the message should still be sent, or false if the message should be discarded.

For example, to check if a chat message starts with "/command", use this code:

if string_copy(argument0, 18) == "/command"
{
    show_message("A command!")
    return false
}
return true

Replies (17)

Last message on 17 Oct 2020

Alexand3er78 on 12 Oct 2020, 16:10:39
I want to know how to use that of / ban and / kick since I use it and it is useless also how do I limit the characters in the chat?
BabyGolden12 on 29 Mar 2020, 05:29:41
I have 2 questions, How would i do more than one command and secondly how can i find a player id i want using commands so say if i wanted to make a log and i can give my self gold but i want to give someone else it
like /give gold 255 to "player_id"
TehAwesomestKitteh on 17 Jun 2019, 19:39:17
I got an error when gms_script_set_chat_verify(scr_chat_verify) was put before gms_settings. It worked when I put it after so I think that info should be updated in the doc above.
BigWhomas on 16 Mar 2019, 19:35:03
How do I actually set up the chat? I tried before but I did it wrong and it messed up the drawing of the login screen :(
LovaniaTheEntity on 7 Mar 2019, 14:05:33
What the hell!?
I banned a guest from my pc and it banned my whole pc even!.
HELP ME.