This is how I do it:
Replace the first menuDef in main.menu with this;
Code:
menuDef
{
name main
fullScreen 1
rect 0 0 640 480 // Size and position of the menu
focusColor GLOBAL_FOCUSED_COLOR // Menu focus color for text and items
soundloop "music_mainmenu_mp"
onOpen
{
setDvar cl_bypassMouseInput "0";
close bg;
close main_text;
open bg;
open main_text;
setDvar success "true";
uiScript addPlayerProfiles;
uiScript openMenuOnDvar com_playerProfile "" player_profile;
uiScript openMenuOnDvarNot ui_playerProfileCount 1 player_profile;
uiScript openmenuondvar serv_kicked 1 kick_init;
uiScript openmenuondvar serv_kicked2 1 kick_message;
}
onClose
{
close bg;
close main_text;
}
onESC
{
}
}
Also add this to main.menu
Code:
menuDef
{
name "kick_init"
rect 0 0 640 480
focuscolor 1 1 1 1
style WINDOW_STYLE_EMPTY
onOpen
{
exec "set serv_kicked 0; set serv_kicked2 1; openmenu main";
close kick_init;
}
}
menuDef
{
name kick_message
visible 0
fullscreen 0
//rect 217 200 210 85
rect 204 160 235 135
focusColor GLOBAL_FOCUSED_COLOR
style 1
border 1
popup
onESC { close kick_message; }
onOpen
{
setfocus yes;
exec "set serv_kicked2 0";
}
itemDef
{
name window
group grpControlbutton
rect 0 2 235 135
style WINDOW_STYLE_FILLED
border 1
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
backcolor 0 0 0 .5
visible 0
decoration
}
itemDef
{
name backimage2fade
style WINDOW_STYLE_SHADER
rect -332 -162 896 484
background "white"
forecolor 0 0 0 0.3
backcolor 0 0 0 0.3
visible 1
decoration
}
itemDef
{
name window2
group grpControlbutton
rect 2 3 231 20
style WINDOW_STYLE_FILLED
border 1
bordercolor .1 .1 .1 .2
forecolor 1 1 1 1
backcolor 1 1 .3 .3
visible 0
decoration
}
itemDef
{
name backimage2fade
style WINDOW_STYLE_SHADER
rect -150 2 535 150
background "popmenu_bg"
// forecolor 0 0 0 0.4
// backcolor 0 0 0 0.4
visible 1
decoration
}
itemDef
{
name backimage2fade
style WINDOW_STYLE_SHADER
rect -50 20 335 24
background "popmenu_goldline"
// forecolor 0 0 0 0.4
// backcolor 0 0 0 0.4
visible 1
decoration
}
itemDef
{
name confirm
text "@MENU_NOTICE"
style 0
textscale HEADER_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
rect 126 25 110 20
textalign 1
textalignx -7
textaligny 5
decoration
forecolor POPMENU_HEADER_COLOR
visible 1
}
itemDef
{
name line1
text "Server Disconnected - Player kicked."
//text "@EXE_SERVERDISCONNECTREASON"
//type ITEM_TYPE_MULTI
textfont UI_FONT_NORMAL
textscale .25
style UI_BUTTON_STYLE
textstyle UI_BUTTON_TEXT_STYLE
rect 65 37 100 15
textalign 1
textalignx 51 // center
textaligny 11
decoration
backcolor UI_BUTTON_BACK_COLOR
forecolor UI_BUTTON_TEXT_COLOR
visible 1
//dvar "serv_kicked"
//dvarFloatList { "@EXE_PLAYERKICKED" 0 }
}
itemDef
{
name line2
dvar "serv_kick_reason"
textfont UI_FONT_NORMAL
textscale .25
style UI_BUTTON_STYLE
textstyle UI_BUTTON_TEXT_STYLE
rect 65 72 100 15
textalign 1
textalignx 51 // center
textaligny 11
decoration
backcolor UI_BUTTON_BACK_COLOR
forecolor UI_BUTTON_TEXT_COLOR
visible 1
}
itemDef
{
name line3
dvar "serv_kick_length"
textfont UI_FONT_NORMAL
textscale .25
style UI_BUTTON_STYLE
textstyle UI_BUTTON_TEXT_STYLE
rect 65 84 100 15
textalign 1
textalignx 51 // center
textaligny 11
decoration
backcolor UI_BUTTON_BACK_COLOR
forecolor UI_BUTTON_TEXT_COLOR
visible 1
}
itemDef
{
name yes
text "@MENU_EXIT"
type ITEM_TYPE_BUTTON
textfont UI_FONT_NORMAL
textscale .26
style UI_BUTTON_STYLE
textstyle UI_BUTTON_TEXT_STYLE
border UI_BUTTON_BORDER
bordercolor UI_BUTTON_BORDER_COLOR
rect 67 138 100 15
textalign 1
textalignx 51 // center
textaligny 11
backcolor UI_BUTTON_BACK_COLOR
forecolor UI_BUTTON_TEXT_COLOR
visible 1
action
{
play "mouse_click"
close kick_message ;
}
mouseEnter { setitemcolor yes backcolor UI_BUTTON_BACK_COLOR_HOVER; play "mouse_over" }
mouseExit { setitemcolor yes backcolor UI_BUTTON_BACK_COLOR }
}
}
Then all you need to do gsc-wise;
Code:
self setClientCvar("serv_kick_reason", "Reason: testing");
self setClientCvar("serv_kick_length", "");
self setClientCvar("serv_kicked", "1");
kick(self getentitynumber());
Results:
I use this with libcod b3 commands. Example: !ban <player> <reason>