summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2019-08-12 23:47:55 +0100
committerIronClawTrem <louie.nutman@gmail.com>2019-08-12 23:47:55 +0100
commit3b15646332be36d3dcce9d1326ab3c569a8bedea (patch)
treefcefb60359aa1e0cbdf21c20deea8e7cb7113048
parent44c40fb42519e243a4d7561ac7a9ef8e8096d56e (diff)
add !bubbles command
-rw-r--r--src/game/g_active.c8
-rw-r--r--src/game/g_admin.c59
-rw-r--r--src/game/g_admin.h1
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_main.c6
5 files changed, 76 insertions, 1 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index d6a0bb1..446fe47 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1874,6 +1874,14 @@ void ClientThink_real( gentity_t *ent )
ent->suicideTime = 0;
}
+ if( client->pers.bubbleTime && client->pers.bubbleTime < level.time )
+ {
+ gentity_t *bubble;
+
+ client->pers.bubbleTime = level.time + 500;
+ bubble = G_TempEntity( client->ps.origin, EV_PLAYER_TELEPORT_OUT );
+ bubble->s.clientNum = ent->s.clientNum;
+ }
}
/*
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 1cc55b4..7b81696 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -384,7 +384,13 @@ g_admin_cmd_t g_admin_cmds[ ] =
{"astage", G_admin_astage, "stage",
"change the stage for aliens",
"[^3#^7]"
+ },
+
+ {"bubble", G_admin_bubble, "bubble",
+ "continuously spawn bubbles around a player",
+ "[^3name|slot#^7]"
}
+
};
static int adminNumCmds = sizeof( g_admin_cmds ) / sizeof( g_admin_cmds[ 0 ] );
@@ -7528,3 +7534,56 @@ qboolean G_admin_astage( gentity_t *ent, int skiparg )
return qtrue;
}
+
+qboolean G_admin_bubble( gentity_t *ent, int skiparg )
+{
+ int pids[ MAX_CLIENTS ];
+ char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];
+ gentity_t *vic;
+
+ if(g_Bubbles.integer)
+ {
+ if( G_SayArgc() < 2 + skiparg )
+ {
+ ADMP( "^3!bubble: ^7usage: !bubble [name|slot#]\n" );
+ return qfalse;
+ }
+ G_SayArgv( 1 + skiparg, name, sizeof( name ) );
+ if( G_ClientNumbersFromString( name, pids ) != 1 )
+ {
+ G_MatchOnePlayer( pids, err, sizeof( err ) );
+ ADMP( va( "^3!bubble: ^7%s\n", err ) );
+ return qfalse;
+ }
+ vic = &g_entities[ pids[ 0 ] ];
+ if(vic->client->sess.invisible == qtrue)
+ {
+ ADMP( va( "^3!bubble: ^7no connected player by that name or slot #\n" ) );
+ return qfalse;
+ }
+ if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) )
+ {
+ ADMP( "^3!bubble: ^7sorry, but your intended victim has a higher admin"
+ " level than you\n" );
+ return qfalse;
+ }
+
+
+ if( vic->client->pers.bubbleTime )
+ vic->client->pers.bubbleTime = 0;
+ else
+ vic->client->pers.bubbleTime = level.time + 500;
+
+ AP( va( "print \"^3!bubble: ^7bubbles %s for %s^7 by %s\n\"",
+ ( vic->client->pers.bubbleTime ) ? "enabled" : "disabled",
+ vic->client->pers.netname,
+ ( ent ) ? G_admin_adminPrintName( ent ) : "console" ) );
+ }
+ else
+ {
+ ADMP( "^3!bubble: ^7sorry, but bubbles have been disabled on this server.\n" );
+ return qfalse;
+ }
+ return qtrue;
+
+}
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index ed5f99f..7793abe 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -262,6 +262,7 @@ qboolean G_admin_invisible( gentity_t *ent, int skiparg );
qboolean G_admin_setdevmode( gentity_t *ent, int skiparg );
qboolean G_admin_hstage( gentity_t *ent, int skiparg );
qboolean G_admin_astage( gentity_t *ent, int skiparg );
+qboolean G_admin_bubble( gentity_t *ent, int skiparg );
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 80e3076..58a11eb 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -449,6 +449,7 @@ typedef struct
qboolean firstConnect; // This is the first map since connect
qboolean useUnlagged;
statsCounters_t statscounters;
+ int bubbleTime;
} clientPersistant_t;
#define MAX_UNLAGGED_MARKERS 10
@@ -1483,6 +1484,8 @@ extern vmCvar_t g_aimbotAdvertBan;
extern vmCvar_t g_aimbotAdvertBanTime;
extern vmCvar_t g_aimbotAdvertBanReason;
+extern vmCvar_t g_Bubbles;
+
void trap_Printf( const char *fmt );
void trap_Error( const char *fmt );
int trap_Milliseconds( void );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 4299107..ef86b2c 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -235,6 +235,8 @@ vmCvar_t g_aimbotAdvertBan;
vmCvar_t g_aimbotAdvertBanTime;
vmCvar_t g_aimbotAdvertBanReason;
+vmCvar_t g_Bubbles;
+
static cvarTable_t gameCvarTable[ ] =
{
// don't override the cheat state set by the system
@@ -445,7 +447,9 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_aimbotAdvertBan, "g_aimbotAdvertBan", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_aimbotAdvertBanTime, "g_aimbotAdvertBanTime", "0", CVAR_ARCHIVE, 0, qfalse },
- { &g_aimbotAdvertBanReason, "g_aimbotAdvertBanReason", "AUTOBAN: AIMBOT", CVAR_ARCHIVE, 0, qfalse }
+ { &g_aimbotAdvertBanReason, "g_aimbotAdvertBanReason", "AUTOBAN: AIMBOT", CVAR_ARCHIVE, 0, qfalse },
+
+ { &g_Bubbles, "g_Bubbles", "1", CVAR_ARCHIVE, 0, qfalse }
};
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] );