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

Reacties (0)

Laatste bericht op 18 Jun 2022