mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-11 15:52:30 +00:00
Added Normal Radio Flood Protection
This commit is contained in:
parent
b7e2566a31
commit
f864008428
3 changed files with 53 additions and 2 deletions
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.80 2002/05/12 00:07:47 slicer
|
||||||
|
// Added Normal Radio Flood Protection
|
||||||
|
//
|
||||||
// Revision 1.79 2002/05/11 16:22:38 slicer
|
// Revision 1.79 2002/05/11 16:22:38 slicer
|
||||||
// Added a Repeat Flood Protection to Radio
|
// Added a Repeat Flood Protection to Radio
|
||||||
//
|
//
|
||||||
|
@ -583,6 +586,9 @@ struct gclient_s {
|
||||||
//Slicer Flood protect:
|
//Slicer Flood protect:
|
||||||
|
|
||||||
float rd_mute; //Time to be muted
|
float rd_mute; //Time to be muted
|
||||||
|
int rd_Count; //Counter for the last msgs in "xx" secs allowed
|
||||||
|
float rd_time; //Time for the first radio message of the ones to follow
|
||||||
|
|
||||||
int rd_lastRadio; //Code of the last radio used
|
int rd_lastRadio; //Code of the last radio used
|
||||||
int rd_repCount; //Counter for the number of repeated radio msgs
|
int rd_repCount; //Counter for the number of repeated radio msgs
|
||||||
float rd_repTime; //The time for the last repeated radio msg
|
float rd_repTime; //The time for the last repeated radio msg
|
||||||
|
@ -1184,6 +1190,8 @@ extern vmCvar_t g_RQ3_NextMapID;
|
||||||
extern vmCvar_t g_RQ3_radioRepeat;
|
extern vmCvar_t g_RQ3_radioRepeat;
|
||||||
extern vmCvar_t g_RQ3_radioRepeatTime;
|
extern vmCvar_t g_RQ3_radioRepeatTime;
|
||||||
extern vmCvar_t g_RQ3_radioBan;
|
extern vmCvar_t g_RQ3_radioBan;
|
||||||
|
extern vmCvar_t g_RQ3_radioFlood;
|
||||||
|
extern vmCvar_t g_RQ3_radioFloodTime;
|
||||||
|
|
||||||
void trap_Printf( const char *fmt );
|
void trap_Printf( const char *fmt );
|
||||||
void trap_Error( const char *fmt );
|
void trap_Error( const char *fmt );
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.57 2002/05/12 00:07:47 slicer
|
||||||
|
// Added Normal Radio Flood Protection
|
||||||
|
//
|
||||||
// Revision 1.56 2002/05/11 16:22:38 slicer
|
// Revision 1.56 2002/05/11 16:22:38 slicer
|
||||||
// Added a Repeat Flood Protection to Radio
|
// Added a Repeat Flood Protection to Radio
|
||||||
//
|
//
|
||||||
|
@ -257,6 +260,8 @@ vmCvar_t g_RQ3_NextMapID;
|
||||||
vmCvar_t g_RQ3_radioRepeat;
|
vmCvar_t g_RQ3_radioRepeat;
|
||||||
vmCvar_t g_RQ3_radioRepeatTime;
|
vmCvar_t g_RQ3_radioRepeatTime;
|
||||||
vmCvar_t g_RQ3_radioBan;
|
vmCvar_t g_RQ3_radioBan;
|
||||||
|
vmCvar_t g_RQ3_radioFlood;
|
||||||
|
vmCvar_t g_RQ3_radioFloodTime;
|
||||||
|
|
||||||
|
|
||||||
#ifdef MISSIONPACK
|
#ifdef MISSIONPACK
|
||||||
|
@ -366,6 +371,8 @@ static cvarTable_t gameCvarTable[] = {
|
||||||
//Slicer: Matchmode
|
//Slicer: Matchmode
|
||||||
{ &g_RQ3_matchmode, "g_RQ3_matchmode", "0", CVAR_SERVERINFO | CVAR_USERINFO | CVAR_LATCH, 0, qfalse },
|
{ &g_RQ3_matchmode, "g_RQ3_matchmode", "0", CVAR_SERVERINFO | CVAR_USERINFO | CVAR_LATCH, 0, qfalse },
|
||||||
//Slicer: radio protect
|
//Slicer: radio protect
|
||||||
|
{ &g_RQ3_radioFlood, "g_RQ3_radioFlood", "3", 0 , 0, qfalse },
|
||||||
|
{ &g_RQ3_radioFloodTime, "g_RQ3_radioFloodTime", "2", 0 , 0, qfalse },
|
||||||
{ &g_RQ3_radioRepeat, "g_RQ3_radioRepeat", "2", 0 , 0, qfalse },
|
{ &g_RQ3_radioRepeat, "g_RQ3_radioRepeat", "2", 0 , 0, qfalse },
|
||||||
{ &g_RQ3_radioRepeatTime, "g_RQ3_radioRepeat", "1", 0 , 0, qfalse },
|
{ &g_RQ3_radioRepeatTime, "g_RQ3_radioRepeat", "1", 0 , 0, qfalse },
|
||||||
{ &g_RQ3_radioBan, "g_RQ3_radioBan", "10", 0 , 0, qfalse },
|
{ &g_RQ3_radioBan, "g_RQ3_radioBan", "10", 0 , 0, qfalse },
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.88 2002/05/12 00:07:47 slicer
|
||||||
|
// Added Normal Radio Flood Protection
|
||||||
|
//
|
||||||
// Revision 1.87 2002/05/11 16:22:38 slicer
|
// Revision 1.87 2002/05/11 16:22:38 slicer
|
||||||
// Added a Repeat Flood Protection to Radio
|
// Added a Repeat Flood Protection to Radio
|
||||||
//
|
//
|
||||||
|
@ -1202,6 +1205,39 @@ radio_msg_t female_radio_msgs[] = {
|
||||||
{ "END", 0 }, // end of list delimiter
|
{ "END", 0 }, // end of list delimiter
|
||||||
};
|
};
|
||||||
//Slicer Adding Flood Protection Functions
|
//Slicer Adding Flood Protection Functions
|
||||||
|
qboolean CheckForFlood (gentity_t * ent)
|
||||||
|
{
|
||||||
|
//If he's muted..
|
||||||
|
if (ent->client->rd_mute) {
|
||||||
|
if (ent->client->rd_mute > level.time) // Still muted..
|
||||||
|
return qfalse;
|
||||||
|
else
|
||||||
|
ent->client->rd_mute = 0; // No longer muted..
|
||||||
|
}
|
||||||
|
if(!ent->client->rd_Count) {
|
||||||
|
ent->client->rd_time = level.time;
|
||||||
|
++ent->client->rd_Count;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++ent->client->rd_Count;
|
||||||
|
if(level.time - ent->client->rd_time < g_RQ3_radioFloodTime.integer) {
|
||||||
|
if(ent->client->rd_Count >= g_RQ3_radioFlood.integer) {
|
||||||
|
trap_SendServerCommand(ent-g_entities, va("print \"Radio Flood Detected, you are silenced for %i secs\n\"",
|
||||||
|
(int) g_RQ3_radioBan.integer));
|
||||||
|
ent->client->rd_mute = level.time + g_RQ3_radioBan.integer*1000;
|
||||||
|
return qfalse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ent->client->rd_Count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return qtrue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
qboolean CheckForRepeat (gentity_t *ent, int radioCode) {
|
qboolean CheckForRepeat (gentity_t *ent, int radioCode) {
|
||||||
int lastRadioCode;
|
int lastRadioCode;
|
||||||
//If he's muted..
|
//If he's muted..
|
||||||
|
@ -1260,8 +1296,8 @@ void RQ3_Cmd_Radio_f(gentity_t *ent)
|
||||||
|
|
||||||
while (Q_stricmp(radio_msgs[x].msg, "END")) {
|
while (Q_stricmp(radio_msgs[x].msg, "END")) {
|
||||||
if (!Q_stricmp(radio_msgs[x].msg, msg)) {
|
if (!Q_stricmp(radio_msgs[x].msg, msg)) {
|
||||||
//Slicer Checking for repeat flood
|
//Slicer Checking for flood protections
|
||||||
if(!CheckForRepeat(ent,x))
|
if(!CheckForRepeat(ent,x) || !CheckForFlood (ent))
|
||||||
return;
|
return;
|
||||||
if (!Q_stricmp(radio_msgs[x].msg, "enemyd")) {
|
if (!Q_stricmp(radio_msgs[x].msg, "enemyd")) {
|
||||||
kills = ent->client->killStreak;
|
kills = ent->client->killStreak;
|
||||||
|
|
Loading…
Reference in a new issue