[Detailed Tutorial] How To Add A Custom Command

Posted by CharaKayra
First we need to add chat to the game and toggle it on and off with a keyboard button.

obj_player Create Event:
//When Room Starts Chat Goes Got Disabled

chat = false


obj_player Step Event:
//Checks if player pressed tab

if(keyboard_check_pressed(vk_tab))
{
    if(chat==false)
    {
        //if the chat is disabled enable it

        chat=true
    }else
    {
        //if the chat is enabled disable it

        chat=false
    }
}

if(chat)
    {
        //if chat is true let us see the chat

        gms_draw_toggle(true)
    }else
    {
        //if its not destroy it

        gms_draw_toggle(false)
    }


obj_player Draw:
if(chat)
{
        gms_chat_draw()
        
}


So test it now it should work

Now... We're about to add a custom command

Lets Create A Basic Kick Script in Scripts Folder and Call it custom_kick
///givevip(player)

if string_copy(argument0, 111) == "/customkick"
{
    if(gms_self_admin_rights() > 0)
    {
    var player = string_copy(argument0,13,string_length(argument0))
    show_debug_message(player)
    gms_admin_kick(player,"test")
    }
    return false
}
return true


Then Go to your Game Maker Server Object And Add This After gms_setting code

gms_script_set_chat_verify(custom_kick)


It Should Work If It's Not You Can Write On Comments

Replies (1)

Last message on 1 Apr 2023

pro_dev_game on 1 Apr 2023, 13:07:08
thanks