mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-01-22 09:31:11 +00:00
Changed two commands to use player's numbers instead of names, "referee" and "ref kick". Minor tweaks
This commit is contained in:
parent
d724a2a393
commit
33bee2c315
2 changed files with 46 additions and 25 deletions
|
@ -61,6 +61,7 @@
|
||||||
* Added a clientside cvar (cg_RQ3_SuicideLikeARealMan) to control frag lossage on suicides
|
* Added a clientside cvar (cg_RQ3_SuicideLikeARealMan) to control frag lossage on suicides
|
||||||
* Fixed stats for non-TP gametypes
|
* Fixed stats for non-TP gametypes
|
||||||
* Cleaned up server logging and added real timestamping to them.
|
* Cleaned up server logging and added real timestamping to them.
|
||||||
|
* MM: "referee" voting command and ref's "kick" user command now uses player's numbers instead of names
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ void checkRefVotes()
|
||||||
if (refVotes[0] == refVotes[1]) {
|
if (refVotes[0] == refVotes[1]) {
|
||||||
// ent = g_entities + refVotes[0];
|
// ent = g_entities + refVotes[0];
|
||||||
refVotes[0]->client->sess.referee = 1;
|
refVotes[0]->client->sess.referee = 1;
|
||||||
trap_SendServerCommand(-1, va("cp \"%s is now a Referee.\n\"", refVotes[0]->client->pers.netname));
|
trap_SendServerCommand(-1, va("cp \"%s" MM_OK_COLOR " is now a Referee.\n\"", refVotes[0]->client->pers.netname));
|
||||||
refVotes[0] = refVotes[1] = NULL;
|
refVotes[0] = refVotes[1] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,8 @@ For captains to vote a referee*/
|
||||||
void MM_Referee_f(gentity_t * ent)
|
void MM_Referee_f(gentity_t * ent)
|
||||||
{
|
{
|
||||||
gentity_t *ref;
|
gentity_t *ref;
|
||||||
char *buff;
|
char cmd[MAX_TOKEN_CHARS];
|
||||||
|
int clientNr;
|
||||||
team_t captain;
|
team_t captain;
|
||||||
|
|
||||||
if (!g_RQ3_matchmode.integer)
|
if (!g_RQ3_matchmode.integer)
|
||||||
|
@ -337,17 +338,24 @@ void MM_Referee_f(gentity_t * ent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (trap_Argc() < 2) {
|
if (trap_Argc() < 2) {
|
||||||
/*if (Ref_Exists()) {
|
|
||||||
ref = g_entities + g_RQ3_RefID.integer;
|
|
||||||
trap_SendServerCommand(ent - g_entities,
|
|
||||||
va("print \"Current Referee: %s\n\"", ref->client->pers.netname));
|
|
||||||
} else
|
|
||||||
trap_SendServerCommand(ent - g_entities,
|
|
||||||
va("print \""MM_DENY_COLOR"No Referee currently assigned, use referee <name>"MM_DENY_COLOR" to assign\n\""));*/
|
|
||||||
trap_SendServerCommand(ent - g_entities,
|
trap_SendServerCommand(ent - g_entities,
|
||||||
va("print \""MM_DENY_COLOR"Use referee <name> to vote a referee\n\""));
|
va("print \""MM_DENY_COLOR"Use referee <player number> to vote a referee\n\""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
trap_Argv(1, cmd, sizeof(cmd));
|
||||||
|
clientNr = atoi(cmd);
|
||||||
|
if(clientNr < 0 || clientNr > level.maxclients) {
|
||||||
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Number - use <playerlist>\n\""));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ref = &g_entities[clientNr];
|
||||||
|
|
||||||
|
if (!ref->inuse || !ref->client) {
|
||||||
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Number - use <playerlist>\n\""));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if((g_RQ3_mmflags.integer & MMF_VOTEREF) != MMF_VOTEREF) {
|
if((g_RQ3_mmflags.integer & MMF_VOTEREF) != MMF_VOTEREF) {
|
||||||
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow captains to vote for a Referee\n\""));
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow captains to vote for a Referee\n\""));
|
||||||
return;
|
return;
|
||||||
|
@ -356,18 +364,11 @@ void MM_Referee_f(gentity_t * ent)
|
||||||
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Too many referees already on the server\n\""));
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Too many referees already on the server\n\""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buff = ConcatArgs(1);
|
|
||||||
if ((ref = getEntByName(buff)) != NULL) {
|
|
||||||
refVotes[captain - 1] = ref;
|
|
||||||
trap_SendServerCommand(-1,
|
|
||||||
va("print \""MM_OK_COLOR"%s has voted %s"MM_OK_COLOR" for referee\n\"",
|
|
||||||
ent->client->pers.netname, ref->client->pers.netname));
|
|
||||||
checkRefVotes();
|
|
||||||
} else {
|
|
||||||
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Name\n\""));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
refVotes[captain - 1] = ref;
|
||||||
|
trap_SendServerCommand(-1,va("print \"%s"MM_OK_COLOR" has voted %s"MM_OK_COLOR" for referee\n\"",
|
||||||
|
ent->client->pers.netname, ref->client->pers.netname));
|
||||||
|
checkRefVotes();
|
||||||
|
|
||||||
}
|
}
|
||||||
void MM_ClearScores(qboolean clearTeamFlags)
|
void MM_ClearScores(qboolean clearTeamFlags)
|
||||||
|
@ -448,6 +449,11 @@ qboolean Ref_Auth(gentity_t * ent)
|
||||||
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are already the referee\n\""));
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are already the referee\n\""));
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
if (trap_Argc() < 2) {
|
||||||
|
trap_SendServerCommand(ent - g_entities,
|
||||||
|
va("print \""MM_DENY_COLOR"Use reflogin <password> to become a referee\n\""));
|
||||||
|
return qfalse;
|
||||||
|
}
|
||||||
trap_Argv(1, pass, sizeof(pass));
|
trap_Argv(1, pass, sizeof(pass));
|
||||||
|
|
||||||
|
|
||||||
|
@ -501,6 +507,7 @@ void Ref_Command(gentity_t * ent)
|
||||||
char param[MAX_TOKEN_CHARS];
|
char param[MAX_TOKEN_CHARS];
|
||||||
char arg2[MAX_STRING_CHARS];
|
char arg2[MAX_STRING_CHARS];
|
||||||
int cn, i;
|
int cn, i;
|
||||||
|
gentity_t *p;
|
||||||
|
|
||||||
//cn = ent - g_entities;
|
//cn = ent - g_entities;
|
||||||
if (!ent->client->sess.referee) {
|
if (!ent->client->sess.referee) {
|
||||||
|
@ -513,7 +520,7 @@ void Ref_Command(gentity_t * ent)
|
||||||
// nice strcmp for each comand (borring, wheres my beer?)
|
// nice strcmp for each comand (borring, wheres my beer?)
|
||||||
if (Q_stricmp(com, "help") == 0) {
|
if (Q_stricmp(com, "help") == 0) {
|
||||||
// Theres a clean way to do this - add more help here (this is for example only)
|
// Theres a clean way to do this - add more help here (this is for example only)
|
||||||
trap_SendServerCommand(ent - g_entities, "print \"kick player\n\"");
|
trap_SendServerCommand(ent - g_entities, "print \"kick <player number>\n\"");
|
||||||
trap_SendServerCommand(ent - g_entities, "print \"map_restart\n\"");
|
trap_SendServerCommand(ent - g_entities, "print \"map_restart\n\"");
|
||||||
trap_SendServerCommand(ent - g_entities, "print \"clearscores\n\"");
|
trap_SendServerCommand(ent - g_entities, "print \"clearscores\n\"");
|
||||||
trap_SendServerCommand(ent - g_entities, "print \"pause\n\"");
|
trap_SendServerCommand(ent - g_entities, "print \"pause\n\"");
|
||||||
|
@ -542,17 +549,30 @@ void Ref_Command(gentity_t * ent)
|
||||||
trap_Argv(2, com, sizeof(com));
|
trap_Argv(2, com, sizeof(com));
|
||||||
if (Q_stricmp(com, "") == 0) {
|
if (Q_stricmp(com, "") == 0) {
|
||||||
trap_SendServerCommand(ent - g_entities,
|
trap_SendServerCommand(ent - g_entities,
|
||||||
va("print \""MM_DENY_COLOR"You must name a player. Use: ref kick <player_name>\n\""));
|
va("print \""MM_DENY_COLOR"You must specify a player number - use <playerlist>\n\""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cn = ClientNumberFromString(ent, com);
|
/*cn = ClientNumberFromString(ent, com);
|
||||||
if (cn == -1) {
|
if (cn == -1) {
|
||||||
trap_SendServerCommand(ent - g_entities,
|
trap_SendServerCommand(ent - g_entities,
|
||||||
va("print \"%s "MM_DENY_COLOR"is not on the server\n\"", com));
|
va("print \"%s "MM_DENY_COLOR"is not on the server\n\"", com));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trap_DropClient(cn, "was kicked by the referee");
|
trap_DropClient(cn, "was kicked by the referee");*/
|
||||||
|
cn = atoi(com);
|
||||||
|
if(cn < 0 || cn > level.maxclients) {
|
||||||
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Number - use <playerlist>\n\""));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p = &g_entities[cn];
|
||||||
|
|
||||||
|
if (!p->inuse || !p->client) {
|
||||||
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Number - use <playerlist>\n\""));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
trap_DropClient(p - g_entities,"was kicked by the referee");
|
||||||
|
|
||||||
} else if (Q_stricmp(com, "clearscores") == 0) {
|
} else if (Q_stricmp(com, "clearscores") == 0) {
|
||||||
MM_ClearScores(qfalse);
|
MM_ClearScores(qfalse);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue