about summary refs log tree commit diff
path: root/src/game/client/components/voting.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-26 16:56:59 +0100
committeroy <Tom_Adams@web.de>2011-03-26 16:56:59 +0100
commitb8f144ba811708bfac82faed438ce389f3d01863 (patch)
tree8ffd9e74b4edacbbd00fa1cc3fdf0a1d381e9c51 /src/game/client/components/voting.cpp
parent0e207fba6f2172071e15ad997103e71a03e81eef (diff)
downloadzcatch-b8f144ba811708bfac82faed438ce389f3d01863.tar.gz
zcatch-b8f144ba811708bfac82faed438ce389f3d01863.zip
added a vote that allows to move a player to spectators. Closes #58
Diffstat (limited to 'src/game/client/components/voting.cpp')
-rw-r--r--src/game/client/components/voting.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp
index 6e00a5d5..d8c87855 100644
--- a/src/game/client/components/voting.cpp
+++ b/src/game/client/components/voting.cpp
@@ -31,6 +31,22 @@ void CVoting::Callvote(const char *pType, const char *pValue, const char *pReaso
 	Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
 }
 
+void CVoting::CallvoteSpectate(int ClientID, const char *pReason, bool ForceVote)
+{
+	if(ForceVote)
+	{
+		char aBuf[128];
+		str_format(aBuf, sizeof(aBuf), "set_team %d -1", ClientID);
+		Client()->Rcon(aBuf);
+	}
+	else
+	{
+		char aBuf[32];
+		str_format(aBuf, sizeof(aBuf), "%d", ClientID);
+		Callvote("spectate", aBuf, pReason);
+	}
+}
+
 void CVoting::CallvoteKick(int ClientID, const char *pReason, bool ForceVote)
 {
 	if(ForceVote)