mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-01-22 01:21:12 +00:00
Item replacement fixes, tmp ban after votekicks and ignore now works on
players with colors.
This commit is contained in:
parent
889781a4b7
commit
0bc2c4251f
3 changed files with 100 additions and 14 deletions
|
@ -5,6 +5,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.125 2003/03/22 20:19:20 jbravo
|
||||
// Item replacement fixes, tmp ban after votekicks and ignore now works on
|
||||
// players with colors.
|
||||
//
|
||||
// Revision 1.124 2003/03/10 01:32:35 jbravo
|
||||
// skin only replacements can now have icons of their own.
|
||||
//
|
||||
|
@ -2484,8 +2488,14 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_kevlar_model) && (strlen(RQ3_kevlar_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_kevlar_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_kevlar_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading kevlar replacement model %s\n", cg_RQ3_kevlar.string);
|
||||
if (strcmp(cg_RQ3_kevlar_skin.string, "default")) {
|
||||
Com_sprintf(RQ3_kevlar_icon, MAX_MODEL_LEN, "icons/iconi_%s", cg_RQ3_kevlar_skin.string);
|
||||
if (JB_FileExists(RQ3_kevlar_icon))
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_kevlar_icon;
|
||||
else
|
||||
CG_Printf("^1Error loading kevlar replacement icon %s\n", cg_RQ3_kevlar_skin.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "item_silencer") && strcmp(cg_RQ3_silencer.string, "silencer")) {
|
||||
|
@ -2494,8 +2504,14 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_silencer_model) && (strlen(RQ3_silencer_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_silencer_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_silencer_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading silencer replacement model %s\n", cg_RQ3_silencer.string);
|
||||
if (strcmp(cg_RQ3_silencer_skin.string, "default")) {
|
||||
Com_sprintf(RQ3_silencer_icon, MAX_MODEL_LEN, "icons/iconi_%s", cg_RQ3_silencer_skin.string);
|
||||
if (JB_FileExists(RQ3_silencer_icon))
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_silencer_icon;
|
||||
else
|
||||
CG_Printf("^1Error loading silencer replacement icon %s\n", cg_RQ3_silencer_skin.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "item_laser") && strcmp(cg_RQ3_laser.string, "laser")) {
|
||||
|
@ -2504,8 +2520,14 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_laser_model) && (strlen(RQ3_laser_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_laser_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_laser_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading laser replacement model %s\n", cg_RQ3_laser.string);
|
||||
if (strcmp(cg_RQ3_laser_skin.string, "default")) {
|
||||
Com_sprintf(RQ3_laser_icon, MAX_MODEL_LEN, "icons/iconi_%s", cg_RQ3_laser_skin.string);
|
||||
if (JB_FileExists(RQ3_laser_icon))
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_laser_icon;
|
||||
else
|
||||
CG_Printf("^1Error loading laser replacement icon %s\n", cg_RQ3_laser_skin.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "item_bandolier") && strcmp(cg_RQ3_bandolier.string, "bandolier")) {
|
||||
|
@ -2514,8 +2536,14 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_bandolier_model) && (strlen(RQ3_bandolier_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_bandolier_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_bandolier_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading bandolier replacement model %s\n", cg_RQ3_bandolier.string);
|
||||
if (strcmp(cg_RQ3_bandolier_skin.string, "default")) {
|
||||
Com_sprintf(RQ3_bandolier_icon, MAX_MODEL_LEN, "icons/iconi_%s", cg_RQ3_bandolier_skin.string);
|
||||
if (JB_FileExists(RQ3_bandolier_icon))
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_bandolier_icon;
|
||||
else
|
||||
CG_Printf("^1Error loading bandolier replacement icon %s\n", cg_RQ3_bandolier_skin.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "item_slippers") && strcmp(cg_RQ3_slippers.string, "slippers")) {
|
||||
|
@ -2524,8 +2552,14 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_slippers_model) && (strlen(RQ3_slippers_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_slippers_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_slippers_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading slippers replacement model %s\n", cg_RQ3_slippers.string);
|
||||
if (strcmp(cg_RQ3_slippers_skin.string, "default")) {
|
||||
Com_sprintf(RQ3_slippers_icon, MAX_MODEL_LEN, "icons/iconi_%s", cg_RQ3_slippers_skin.string);
|
||||
if (JB_FileExists(RQ3_slippers_icon))
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_slippers_icon;
|
||||
else
|
||||
CG_Printf("^1Error loading slippers replacement icon %s\n", cg_RQ3_slippers_skin.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "item_helmet") && strcmp(cg_RQ3_helmet.string, "helmet")) {
|
||||
|
@ -2534,8 +2568,14 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_helmet_model) && (strlen(RQ3_helmet_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_helmet_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_helmet_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading helmet replacement model %s\n", cg_RQ3_helmet.string);
|
||||
if (strcmp(cg_RQ3_helmet_skin.string, "default")) {
|
||||
Com_sprintf(RQ3_helmet_icon, MAX_MODEL_LEN, "icons/iconi_%s", cg_RQ3_helmet_skin.string);
|
||||
if (JB_FileExists(RQ3_helmet_icon))
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_helmet_icon;
|
||||
else
|
||||
CG_Printf("^1Error loading helmet replacement icon %s\n", cg_RQ3_helmet_skin.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "ammo_mk23") && strcmp(cg_RQ3_ammo_mk23.string, "mk23")) {
|
||||
|
@ -2544,9 +2584,8 @@ void CG_ReplaceModels(void)
|
|||
if (JB_FileExists(RQ3_ammo_mk23_model) && (strlen(RQ3_ammo_mk23_model) < MAX_MODEL_LEN)) {
|
||||
bg_itemlist[item - bg_itemlist].world_model[0] = (char *)&RQ3_ammo_mk23_model;
|
||||
bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_ammo_mk23_icon;
|
||||
} else {
|
||||
} else
|
||||
CG_Printf("^1Error loading mk23 ammo replacement model %s\n", cg_RQ3_ammo_mk23.string);
|
||||
}
|
||||
}
|
||||
if (!strcmp(item->classname, "ammo_shells") && strcmp(cg_RQ3_ammo_shells.string, "shells")) {
|
||||
Com_sprintf(RQ3_ammo_shells_model, MAX_MODEL_LEN, "models/ammo/%s.md3", cg_RQ3_ammo_shells.string);
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.137 2003/03/22 20:19:20 jbravo
|
||||
// Item replacement fixes, tmp ban after votekicks and ignore now works on
|
||||
// players with colors.
|
||||
//
|
||||
// Revision 1.136 2003/03/10 07:07:58 jbravo
|
||||
// Small unlagged fixes and voting delay added.
|
||||
//
|
||||
|
@ -391,6 +395,7 @@
|
|||
#include "q_shared.h"
|
||||
|
||||
int trap_RealTime(qtime_t * qtime);
|
||||
gentity_t *getEntByName(char *name);
|
||||
level_locals_t level;
|
||||
|
||||
typedef struct {
|
||||
|
@ -2279,19 +2284,51 @@ CheckVote
|
|||
*/
|
||||
void CheckVote(void)
|
||||
{
|
||||
char userinfo[MAX_INFO_STRING], votestr[MAX_INFO_STRING];
|
||||
char *value, *kicked;
|
||||
gentity_t *ent;
|
||||
int kickclient;
|
||||
|
||||
if (level.voteExecuteTime && level.voteExecuteTime < level.time) {
|
||||
level.voteExecuteTime = 0;
|
||||
if (Q_stricmp(level.voteString, "cyclemap") == 0)
|
||||
Q_strncpyz(votestr, level.voteString, sizeof(votestr));
|
||||
if (Q_stricmp(level.voteString, "cyclemap") == 0) {
|
||||
BeginIntermission();
|
||||
else if (Q_stricmp(level.voteString, "map") == 0) {
|
||||
} else if (Q_stricmp(level.voteString, "map") == 0) {
|
||||
trap_Cvar_Set("g_RQ3_ValidIniFile", "2"); // check this latter. This trap may not be necessary
|
||||
g_RQ3_ValidIniFile.integer = 2;
|
||||
BeginIntermission();
|
||||
} else if (Q_stricmp(level.voteString, "g_gametype") == 0) {
|
||||
trap_SendConsoleCommand(EXEC_APPEND, va("%s\n", level.voteString));
|
||||
trap_SendConsoleCommand(EXEC_APPEND, "map_restart 0\n");
|
||||
} else
|
||||
} else if (!Q_strncmp(votestr, "kick", 4)) {
|
||||
kicked = strchr(votestr, '\"');
|
||||
kicked++;
|
||||
kicked[strlen(kicked) - 1] = '\0';
|
||||
ent = getEntByName(kicked);
|
||||
if (ent && ent->client) {
|
||||
G_Printf("^1Adding temporary ban for %s\n", ent->client->pers.netname);
|
||||
trap_GetUserinfo(ent - g_entities, userinfo, sizeof(userinfo));
|
||||
value = Info_ValueForKey(userinfo, "ip");
|
||||
AddIP(value);
|
||||
}
|
||||
trap_SendConsoleCommand(EXEC_APPEND, va("%s\n", level.voteString));
|
||||
} else if (!Q_strncmp(votestr, "clientkick", 10)) {
|
||||
kicked = strchr(votestr, '\"');
|
||||
kicked++;
|
||||
kicked[strlen(kicked) - 1] = '\0';
|
||||
kickclient = atoi(kicked);
|
||||
ent = g_entities + kickclient;
|
||||
if (ent && ent->client) {
|
||||
G_Printf("^1Adding temporary ban for %s\n", ent->client->pers.netname);
|
||||
trap_GetUserinfo(ent - g_entities, userinfo, sizeof(userinfo));
|
||||
value = Info_ValueForKey(userinfo, "ip");
|
||||
AddIP(value);
|
||||
}
|
||||
trap_SendConsoleCommand(EXEC_APPEND, va("%s\n", level.voteString));
|
||||
} else {
|
||||
trap_SendConsoleCommand(EXEC_APPEND, va("%s\n", level.voteString));
|
||||
}
|
||||
}
|
||||
if (!level.voteTime) {
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.149 2003/03/22 20:19:20 jbravo
|
||||
// Item replacement fixes, tmp ban after votekicks and ignore now works on
|
||||
// players with colors.
|
||||
//
|
||||
// Revision 1.148 2003/03/21 11:32:04 jbravo
|
||||
// Added debugging to locate the bad gEnt crashes, added timelimit support
|
||||
// for CTB and TDM and fixed some typos
|
||||
|
@ -494,15 +498,21 @@ gentity_t *FindClientByPersName(char *name)
|
|||
{
|
||||
int i;
|
||||
gentity_t *other, *found;
|
||||
char cleanname[MAX_NETNAME];
|
||||
|
||||
found = NULL;
|
||||
cleanname[0] = '\0';
|
||||
for (i = 0; i <= level.maxclients; i++) {
|
||||
other = &g_entities[i];
|
||||
if (!other->inuse)
|
||||
continue;
|
||||
if (other && other->client && (Q_stricmp(other->client->pers.netname, name) == 0)) {
|
||||
found = other;
|
||||
break;
|
||||
if (other && other->client) {
|
||||
strcpy(cleanname, other->client->pers.netname);
|
||||
Q_CleanStr(cleanname);
|
||||
if (Q_stricmp(name, cleanname) == 0) {
|
||||
found = other;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (found);
|
||||
|
|
Loading…
Reference in a new issue