diff -Naur ./src_/game/client/components/menus_ingame.cpp ./src/game/client/components/menus_ingame.cpp --- ./src_/game/client/components/menus_ingame.cpp 2010-06-20 11:27:56.782603600 +0200 +++ ./src/game/client/components/menus_ingame.cpp 2010-06-19 19:14:49.380368000 +0200 @@ -335,7 +335,7 @@ RECT button; - const char *tabs[] = {"Options", "Kick"}; // Dunedune + const char *tabs[] = {"Options", "Kick", "Admin"}; // Dunedune int num_tabs = (int)(sizeof(tabs)/sizeof(*tabs)); for(int i = 0; i < num_tabs; i++) @@ -360,11 +360,12 @@ // render page if(control_page == 0) render_servercontrol_server(main_view); - else if(control_page == 1) // Dunedune + else if(control_page == 1 || control_page == 2) // Dunedune render_servercontrol_kick(main_view); - + if(control_page != 2) // Not "Admin" + { RECT button; ui_vsplit_r(&bottom, 120.0f, &bottom, &button); @@ -388,7 +389,143 @@ set_active(false); } } + } + } + else // Dunedune : "admin" + { + RECT button; + + char buf[64]; + + ui_vsplit_r(&bottom, 80.0f, &bottom, &button); + + ui_vsplit_r(&button, 90.0f, 0, &button); + ui_vsplit_r(&button, 20.0f, &button, 0); + + static int spec_button = 0; + static int team1_button = 0; + static int team2_button = 0; + static int kick_button = 0; + static int ban_button = 0; + static int mute_button = 0; + static int unmute_button = 0; + + static int ban_time = 5; + + if(!(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && gameclient.snap.player_infos[callvote_selectedplayer])) + return; + + int team = gameclient.snap.player_infos[callvote_selectedplayer]->team; + if(team != 1) + { + if(ui_do_button(&spec_button, "Blue", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon set_team %d 1", callvote_selectedplayer); + console_execute_line(buf); + } + } + } + + if(team != 0) + { + if(team != 1) + { + ui_vsplit_r(&button, 150.0f, 0, &button); + ui_vsplit_r(&button, 80.0f, &button, 0); + } + if(ui_do_button(&team1_button, "Red", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon set_team %d 0", callvote_selectedplayer); + console_execute_line(buf); + } + } + } + + if(team != -1) + { + ui_vsplit_r(&button, 150.0f, 0, &button); + ui_vsplit_r(&button, 80.0f, &button, 0); + if(ui_do_button(&team2_button, "Spec", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon set_team %d -1", callvote_selectedplayer); + console_execute_line(buf); + } + } + } + + ui_vsplit_r(&button, 170.0f, 0, &button); + ui_vsplit_r(&button, 100.0f, &button, 0); + + if(ui_do_button(&unmute_button, "Unmute", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon unmute %d", callvote_selectedplayer); + console_execute_line(buf); + } + } + + ui_vsplit_r(&button, 150.0f, 0, &button); + ui_vsplit_r(&button, 80.0f, &button, 0); + + if(ui_do_button(&mute_button, "Mute", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon mute %d", callvote_selectedplayer); + console_execute_line(buf); + } + } + + ui_vsplit_r(&button, 170.0f, 0, &button); + ui_vsplit_r(&button, 100.0f, &button, 0); + + if(ui_do_button(&ban_button, "Ban", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon ban %d %d", callvote_selectedplayer, ban_time); + console_execute_line(buf); + } + } + ui_vsplit_r(&button, 150.0f, 0, &button); + ui_vsplit_r(&button, 80.0f, &button, 0); + + if(ui_do_button(&kick_button, "Kick", 0, &button, ui_draw_menu_button, 0)) + { + if(callvote_selectedplayer >= 0 && callvote_selectedplayer < MAX_CLIENTS && + gameclient.snap.player_infos[callvote_selectedplayer]) + { + str_format(buf, sizeof(buf), "rcon kick %d", callvote_selectedplayer); + console_execute_line(buf); + } + } + + ui_vsplit_l(&bottom, 10.0f, &bottom, &button); + ui_do_label(&button, "Ban time:", 15.0f, -1); + // ui_vsplit_r(&button, 100.0f, &button, 0); + + str_format(buf, sizeof(buf), "%d", ban_time); + ui_vsplit_l(&button, 115.0f, &button, 0); + ui_vsplit_l(&button, 75.0f, 0, &button); + ui_do_edit_box(&ban_time, &button, buf, sizeof(buf), 14.0f); + ban_time = atoi(buf); + + + } }