fixed so that some vote error messages isn't broadcasted to everyone

This commit is contained in:
Magnus Auvinen 2009-01-11 14:28:35 +00:00
parent 172463b2bb
commit 96e65f599a
3 changed files with 18 additions and 5 deletions

View file

@ -158,6 +158,18 @@ void GAMECONTEXT::create_sound_global(int sound, int target)
server_send_msg(target);
}
void GAMECONTEXT::send_chat_target(int to, const char *text)
{
NETMSG_SV_CHAT msg;
msg.team = 0;
msg.cid = -1;
msg.message = text;
msg.pack(MSGFLAG_VITAL);
server_send_msg(to);
}
void GAMECONTEXT::send_chat(int chatter_cid, int team, const char *text)
{
if(chatter_cid >= 0 && chatter_cid < MAX_CLIENTS)

View file

@ -78,6 +78,7 @@ public:
};
// network
void send_chat_target(int to, const char *text);
void send_chat(int cid, int team, const char *text);
void send_emoticon(int cid, int emoticon);
void send_weapon_pickup(int cid, int weapon);

View file

@ -177,7 +177,7 @@ void mods_message(int msgtype, int client_id)
int64 now = time_get();
if(game.vote_closetime)
{
game.send_chat(-1, client_id, "Wait for current vote to end before calling a new one.");
game.send_chat_target(client_id, "Wait for current vote to end before calling a new one.");
return;
}
@ -186,7 +186,7 @@ void mods_message(int msgtype, int client_id)
{
char chatmsg[512] = {0};
str_format(chatmsg, sizeof(chatmsg), "You must wait %d seconds before making another vote", (timeleft/time_freq())+1);
game.send_chat(-1, client_id, chatmsg);
game.send_chat_target(client_id, chatmsg);
return;
}
@ -213,7 +213,7 @@ void mods_message(int msgtype, int client_id)
if(!option)
{
str_format(chatmsg, sizeof(chatmsg), "'%s' isn't an option on this server", msg->value);
game.send_chat(-1, client_id, chatmsg);
game.send_chat_target(client_id, chatmsg);
return;
}
}
@ -221,14 +221,14 @@ void mods_message(int msgtype, int client_id)
{
if(!config.sv_vote_kick)
{
game.send_chat(-1, client_id, "Server does not allow voting to kick players");
game.send_chat_target(client_id, "Server does not allow voting to kick players");
return;
}
int kick_id = atoi(msg->value);
if(kick_id < 0 || kick_id >= MAX_CLIENTS || !game.players[kick_id])
{
game.send_chat(-1, client_id, "Invalid client id to kick");
game.send_chat_target(client_id, "Invalid client id to kick");
return;
}