about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-17 00:27:41 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-17 00:27:41 +0000
commita6aec9e0cd6901ce8cddef57f876626f9e3de7eb (patch)
tree5eac05f39b5f1eef68de420161c337acbc4e684b /src
parent64dd53133ce51c4c699d12618d1af2a478e102f9 (diff)
downloadzcatch-a6aec9e0cd6901ce8cddef57f876626f9e3de7eb.tar.gz
zcatch-a6aec9e0cd6901ce8cddef57f876626f9e3de7eb.zip
added the ability to kick players
Diffstat (limited to 'src')
-rw-r--r--src/engine/e_interface.h1
-rw-r--r--src/engine/server/es_server.c7
-rw-r--r--src/game/client/gc_client.cpp15
-rw-r--r--src/game/g_variables.h2
-rw-r--r--src/game/server/gs_server.cpp6
5 files changed, 23 insertions, 8 deletions
diff --git a/src/engine/e_interface.h b/src/engine/e_interface.h
index 170d1ba5..f5920411 100644
--- a/src/engine/e_interface.h
+++ b/src/engine/e_interface.h
@@ -757,6 +757,7 @@ void server_setclientname(int client_id, const char *name);
 void server_setclientscore(int client_id, int score);
 
 void server_setbrowseinfo(int game_type, int progression);
+void server_kick(int client_id, const char *reason);
 
 int server_tick();
 int server_tickspeed();
diff --git a/src/engine/server/es_server.c b/src/engine/server/es_server.c
index 675e778c..6683ac1a 100644
--- a/src/engine/server/es_server.c
+++ b/src/engine/server/es_server.c
@@ -206,6 +206,12 @@ void server_setbrowseinfo(int game_type, int progression)
 	browseinfo_progression = progression;
 }
 
+void server_kick(int client_id, const char *reason)
+{
+	if(clients[client_id].state != SRVCLIENT_STATE_EMPTY)
+		netserver_drop(net, client_id, reason);
+}
+
 int server_tick()
 {
 	return current_tick;
@@ -479,7 +485,6 @@ static int del_client_callback(int cid, void *user)
 	return 0;
 }
 
-
 static void server_send_map(int cid)
 {
 	msg_pack_start_system(NETMSG_MAP, MSGFLAG_VITAL);
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index 51598306..ed31d5a0 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -1940,12 +1940,6 @@ void render_spectators(float x, float y, float w)
 
 void render_scoreboard(float x, float y, float w, int team, const char *title)
 {
-	//float w = 550.0f;
-	//float x = width/2-w/2;
-	//;
-	//float y = ystart;
-	//float w = 550.0f;
-
 	animstate idlestate;
 	anim_eval(&data->animations[ANIM_BASE], 0, &idlestate);
 	anim_eval_add(&idlestate, &data->animations[ANIM_IDLE], 0, 1.0f);
@@ -2057,7 +2051,14 @@ void render_scoreboard(float x, float y, float w, int team, const char *title)
 
 		sprintf(buf, "%4d", info->score);
 		gfx_pretty_text(x+60-gfx_pretty_text_width(font_size,buf,-1), y, font_size, buf, -1);
-		gfx_pretty_text(x+128, y, font_size, client_datas[info->clientid].name, -1);
+		
+		if(config.cl_show_player_ids)
+		{
+			sprintf(buf, "%d | %s", info->clientid, client_datas[info->clientid].name);
+			gfx_pretty_text(x+128, y, font_size, buf, -1);
+		}
+		else
+			gfx_pretty_text(x+128, y, font_size, client_datas[info->clientid].name, -1);
 
 		sprintf(buf, "%4d", info->latency);
 		float tw = gfx_pretty_text_width(font_size, buf, -1);
diff --git a/src/game/g_variables.h b/src/game/g_variables.h
index c2d2eb2c..6cd2540b 100644
--- a/src/game/g_variables.h
+++ b/src/game/g_variables.h
@@ -32,6 +32,7 @@ MACRO_CONFIG_INT(cl_nameplates_always, 0, 0, 1)
 MACRO_CONFIG_INT(cl_dynamic_camera, 1, 0, 1)
 MACRO_CONFIG_INT(cl_team, -10, -1, 0)
 MACRO_CONFIG_INT(cl_autoswitch_weapons, 0, 0, 1)
+MACRO_CONFIG_INT(cl_show_player_ids, 0, 0, 1)
 
 MACRO_CONFIG_INT(cl_show_welcome, 1, 0, 1)
 
@@ -61,6 +62,7 @@ MACRO_CONFIG_INT(sv_scorelimit, 20, 0, 1000)
 MACRO_CONFIG_INT(sv_timelimit, 0, 0, 1000)
 MACRO_CONFIG_STR(sv_gametype, 32, "dm")
 MACRO_CONFIG_INT(sv_restart, 0, 0, 120)
+MACRO_CONFIG_INT(sv_kick, -1, 0, 0)
 
 
 
diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp
index f9597893..e11760e0 100644
--- a/src/game/server/gs_server.cpp
+++ b/src/game/server/gs_server.cpp
@@ -1706,6 +1706,12 @@ void mods_tick()
 		send_chat(-1, -1, config.sv_msg);
 		config.sv_msg[0] = 0;
 	}
+	
+	if(config.sv_kick != -1)
+	{
+		server_kick(config.sv_kick, "kicked");
+		config.sv_kick = -1;
+	}
 }
 
 void mods_snap(int client_id)