about summary refs log tree commit diff
path: root/src/game/server/hooks.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-09-25 12:23:44 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-09-25 12:23:44 +0000
commitaaaba4f4039f3643d1a040dfe1c9715be49371e2 (patch)
treec396f83ae65eaa4b0f7799eb3650de6b72276dd9 /src/game/server/hooks.cpp
parent059c2ee4cb4d0860b1faf86f2f3b17511260867c (diff)
downloadzcatch-aaaba4f4039f3643d1a040dfe1c9715be49371e2.tar.gz
zcatch-aaaba4f4039f3643d1a040dfe1c9715be49371e2.zip
continued on the voting
Diffstat (limited to 'src/game/server/hooks.cpp')
-rw-r--r--src/game/server/hooks.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/game/server/hooks.cpp b/src/game/server/hooks.cpp
index 494f4f62..3a034a97 100644
--- a/src/game/server/hooks.cpp
+++ b/src/game/server/hooks.cpp
@@ -126,6 +126,33 @@ void mods_message(int msgtype, int client_id)
 		
 		game.send_chat(client_id, team, msg->message);
 	}
+	else if(msgtype == NETMSGTYPE_CL_CALLVOTE)
+	{
+		char chatmsg[512] = {0};
+		char desc[512] = {0};
+		char cmd[512] = {0};
+		NETMSG_CL_CALLVOTE *msg = (NETMSG_CL_CALLVOTE *)rawmsg;
+		if(str_comp_nocase(msg->type, "map") == 0)
+		{
+			str_format(chatmsg, sizeof(chatmsg), "Vote called to change map to '%s'", msg->value);
+			str_format(desc, sizeof(desc), "Change map to '%s'", msg->value);
+			str_format(cmd, sizeof(cmd), "sv_map %s", msg->value);
+		}
+
+		if(cmd[0])
+		{
+			game.send_chat(-1, GAMECONTEXT::CHAT_ALL, chatmsg);
+			game.start_vote(desc, cmd);
+			p->vote = 1;
+			game.send_vote_status(-1);
+		}
+	}
+	else if(msgtype == NETMSGTYPE_CL_VOTE)
+	{
+		NETMSG_CL_VOTE *msg = (NETMSG_CL_VOTE *)rawmsg;
+		p->vote = msg->vote;
+		game.send_vote_status(-1);
+	}
 	else if (msgtype == NETMSGTYPE_CL_SETTEAM)
 	{
 		NETMSG_CL_SETTEAM *msg = (NETMSG_CL_SETTEAM *)rawmsg;