## ETPub PCR alpha hacks (etpub_pcr_ah) ## (C) 2006-2007 PatheticCockroach.com ## This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License ## Derivative works may only be done if they are distributed with their source code. ## ## The original etpub_pcr_ah source and binaries can be found around http://www.patheticcockroach.com/etserver/etpub_pcr.php ## ## Note : ETPub PCR alpha hacks are just small modifications for ETPub (http://www.etpub.org) Here we applied g_legacyShrub to !lol and !check g_legacyShrub : boolean 0 - New shrubbot commands behavior (eg !pip with no arg pips self, !pip all pips all players) 1 - Shrubbot commands behave like in ETPub (eg !pip with no arg pips all players) default : 1 ------------------------- MODIFICATION STARTS HERE src\game\g_local.h : (line 2154) **** AFTER extern vmCvar_t g_spawnInvul; **** ADDED extern vmCvar_t g_legacyShrub; src\game\g_main.c : (line 257) **** AFTER vmCvar_t g_spawnInvul; **** ADD vmCvar_t g_legacyShrub; (line 755) **** AFTER { &g_spawnInvul, "g_spawnInvul", "3", 0 }, **** ADD { &g_legacyShrub, "g_legacyShrub", "1", 0 }, src\game\g_shrubbot.h : (line 43) **** AFTER // tjw: used by g_shrubbot_cmd.cmdFlags #define SCMDF_TYRANNY 1 **** ADD // etpub_pcr_ah : for command usage help #define SHRUB_PCR_ARG "^3[name|slot^8|all^3]" #define SHRUB_PCR_ARGR "^3[name|slot^8|all^3] ^h[reason]" src\game\g_shrubbot.c : (line 21) **** AFTER extern char bigTextBuffer[100000]; **** ADD extern void ReviveEntity(gentity_t *ent, gentity_t *traceEnt); (line 3609) **** REPLACE qboolean G_shrubbot_config(gentity_t *ent, int skiparg) { SBP_begin(); SBP(va("^/config : ^7showing server configuration\n")); SBP(va("^dg_tyranny : ^2%i\n", g_tyranny.integer)); SBP(va("^dg_friendlyPlant : ^2%i\n", g_friendlyPlant.integer)); SBP(va("^dg_adreDmg : ^2%i\n", g_adreDmg.integer)); SBP(va("^dg_disguiseDmg : ^2%i\n", g_disguiseDmg.integer)); SBP_end(); return qtrue; } **** WITH qboolean G_shrubbot_config(gentity_t *ent, int skiparg) { SPC("^/config : ^7showing server configuration"); SBP_begin(); SBP(va("^dg_tyranny : ^2%i\n", g_tyranny.integer)); SBP(va("^dg_legacyShrub : ^2%i\n", g_legacyShrub.integer)); SBP(va("^dg_friendlyPlant : ^2%i\n", g_friendlyPlant.integer)); SBP(va("^dg_adreDmg : ^2%i\n", g_adreDmg.integer)); SBP(va("^dg_disguiseDmg : ^2%i\n", g_disguiseDmg.integer)); SBP_end(); return qtrue; } (line 76) **** REPLACE {"lol", G_shrubbot_lol, 'x', SCMDF_TYRANNY, "grenades drop from a specified player or all players", "[^3name|slot#|all^7]"}, **** WITH {"lol", G_shrubbot_lol, 'x', SCMDF_TYRANNY, "grenades drop from a specified player or all players", SHRUB_PCR_ARG}, (line 2704) **** REPLACE qboolean G_shrubbot_lol(gentity_t *ent, int skiparg) { int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS], numNades[4]; gentity_t *vic; int pcount, nades = 0, count = 0; if(Q_SayArgc() < 2+skiparg) { if(!ent) { SPC("lol: you are on the console"); return qfalse; } vic=ent; } else if(Q_SayArgc() >= 3+skiparg) { Q_SayArgv( 2+skiparg, numNades, sizeof( numNades ) ); nades = atoi( numNades ); if( nades < 1 ) nades = 1; else if( nades > SHRUBBOT_MAX_LOL_NADES ) nades = SHRUBBOT_MAX_LOL_NADES; } Q_SayArgv( 1+skiparg, name, sizeof( name ) ); if( !Q_stricmp( name, "all" ) ) { int it; for( it = 0; it < level.numConnectedClients; it++ ) { vic = g_entities + level.sortedClients[it]; if( !_shrubbot_admin_higher(ent, vic) || _shrubbot_immutable(ent, vic) || !(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) continue; if( nades ) G_createClusterNade( vic, nades ); else G_createClusterNade( vic, 1 ); count++; } AP(va("chat \"^/lol: ^7%d players lol\'d\" -1", count)); return qtrue; } pcount = ClientNumbersFromString(name, pids); if(pcount > 1) { int it; for( it = 0; it < pcount; it++) { vic = &g_entities[pids[it]]; if(!_shrubbot_admin_higher(ent, vic)) { SPC(va("^/lol: ^7sorry, but %s^7 has a higher " "admin level than you do", vic->client->pers.netname)); continue; } if(_shrubbot_immutable(ent, vic)) { SPC("^/lol: ^7sorry, but your intended victim is immune to shrubbot commands"); continue; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC(va("^/lol: ^7%s^7 must be on a " "team to be lol\'d", vic->client->pers.netname)); continue; } if( nades ) G_createClusterNade( vic, nades ); else G_createClusterNade( vic, 8 ); AP(va("chat \"^/lol: ^7%s\" -1", vic->client->pers.netname)); } return qtrue; } else if( pcount < 1 ) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/lol: ^7%s", err)); return qfalse; } vic = &g_entities[pids[0]]; if(!_shrubbot_admin_higher(ent, vic)) { SPC("^/lol: ^7sorry, but your intended victim has a higher " "admin level than you do"); return qfalse; } if(_shrubbot_immutable(ent, vic)) { SPC("^/lol: ^7sorry, but your intended victim is immune to shrubbot commands"); return qfalse; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC("^/lol: ^7player must be on a team to be lol'd"); return qfalse; } if( nades ) G_createClusterNade( vic, nades ); else G_createClusterNade( vic, 8 ); AP(va("chat \"^/lol: ^7%s\" -1", vic->client->pers.netname)); return qtrue; } **** WITH qboolean G_shrubbot_lol(gentity_t *ent, int skiparg) { int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS], numNades[4]; gentity_t *vic; qboolean doAll = qfalse; int pcount, nades = 0, count = 0; if(Q_SayArgc() >= 3+skiparg) { Q_SayArgv( 2+skiparg, numNades, sizeof( numNades ) ); nades = atoi( numNades ); if( nades < 1 ) nades = 1; else if( nades > SHRUBBOT_MAX_LOL_NADES ) nades = SHRUBBOT_MAX_LOL_NADES; } if(Q_SayArgc() < 2+skiparg) { if(g_legacyShrub.integer==1) doAll = qtrue; else { if(!ent) { SPC("lol: you are on the console"); return qfalse; } vic=ent; } } else { Q_SayArgv( 1+skiparg, name, sizeof( name ) ); if(!Q_stricmp( name, "all" ) && (g_legacyShrub.integer==0)) doAll=qtrue; else if(!Q_stricmp( name, "-1" ) && (g_legacyShrub.integer==1)) doAll=qtrue; } if( doAll ) { int it; for( it = 0; it < level.numConnectedClients; it++ ) { vic = g_entities + level.sortedClients[it]; if( !_shrubbot_admin_higher(ent, vic) || _shrubbot_immutable(ent, vic) || !(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) continue; if( nades ) G_createClusterNade( vic, nades ); else G_createClusterNade( vic, 1 ); count++; } AP(va("chat \"^/lol: ^7%d players lol\'d\" -1", count)); return qtrue; } pcount = ClientNumbersFromString(name, pids); if(pcount > 1) { int it; if(g_legacyShrub.integer==0) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/lol: ^7%s", err)); return qfalse; } for( it = 0; it < pcount; it++) { vic = &g_entities[pids[it]]; if(!_shrubbot_admin_higher(ent, vic)) { SPC(va("^/lol: ^7sorry, but %s^7 has a higher " "admin level than you do", vic->client->pers.netname)); continue; } if(_shrubbot_immutable(ent, vic)) { SPC("^/lol: ^7sorry, but your intended victim is immune to shrubbot commands"); continue; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC(va("^/lol: ^7%s^7 must be on a " "team to be lol\'d", vic->client->pers.netname)); continue; } if( nades ) G_createClusterNade( vic, nades ); else G_createClusterNade( vic, 8 ); AP(va("chat \"^/lol: ^7%s\" -1", vic->client->pers.netname)); } return qtrue; } else if( (pcount < 1) && (g_legacyShrub.integer==1) ) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/lol: ^7%s", err)); return qfalse; } else { vic = &g_entities[pids[0]]; } if(!_shrubbot_admin_higher(ent, vic)) { SPC("^/lol: ^7sorry, but your intended victim has a higher " "admin level than you do"); return qfalse; } if(_shrubbot_immutable(ent, vic)) { SPC("^/lol: ^7sorry, but your intended victim is immune to shrubbot commands"); return qfalse; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC("^/lol: ^7player must be on a team to be lol'd"); return qfalse; } if( nades ) G_createClusterNade( vic, nades ); else G_createClusterNade( vic, 8 ); AP(va("chat \"^/lol: ^7%s\" -1", vic->client->pers.netname)); return qtrue; } (line 38) **** REPLACE {"check", G_shrubbot_check, 'a', 0, "checks if a player is godmoded", "[^3name|slot#|all^7]"}, **** WITH {"check", G_shrubbot_check, 'a', 0, "checks if a player is godmoded", SHRUB_PCR_ARG}, (line 3387) **** REPLACE qboolean G_shrubbot_check(gentity_t *ent, int skiparg) { int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS]; gentity_t *vic; char *netname; int count=0; if(Q_SayArgc() < 2+skiparg) { if(!ent) { SPC("check: you are on the console"); return qfalse; } vic=ent; } else { Q_SayArgv(1+skiparg, name, sizeof(name)); if( !Q_stricmp( name, "all" ) ) { int it; SBP_begin(); SBP(va("^/check : ^7checking all players for god mode\n")); for( it = 0; it < level.numConnectedClients; it++ ) { vic = g_entities + level.sortedClients[it]; if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) continue; if(vic->flags & FL_GODMODE) { count++; netname = vic->client->pers.netname; SBP(va("^dClient ^7%i (%s^7) : ^1god mode detected\n", level.sortedClients[it], netname)); } } if(count==0) AP(va("chat \"^/check: ^2no player is godmoded here\" -1", count)); else AP(va("chat \"^/check: ^1%d players are currently godmoded\" -1", count)); SBP_end(); return qtrue; } if(ClientNumbersFromString(name, pids) != 1) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/check: ^7%s", err)); return qfalse; } vic = &g_entities[pids[0]]; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC("^/check: ^7player must be on a team"); return qfalse; } if(!vic || !vic->client) { SPC(va("^/check: ^7a weird error occured...")); return qfalse; } if(vic->flags & FL_GODMODE) AP(va("chat \"^/check: ^1!!! ^7%s ^7is ^1godmoded !!!\" -1", vic->client->pers.netname)); else AP(va("chat \"^/check: ^7%s ^7is ^2not godmoded\" -1", vic->client->pers.netname)); return qtrue; } **** WITH qboolean G_shrubbot_check(gentity_t *ent, int skiparg) { int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS]; gentity_t *vic; char *netname; qboolean doAll = qfalse; int count=0; if( (Q_SayArgc() < 2+skiparg) && (g_legacyShrub.integer==1) ) doAll = qtrue; if( (Q_SayArgc() < 2+skiparg) && (g_legacyShrub.integer==0) ) { if(!ent) { SPC("check: you are on the console"); return qfalse; } vic=ent; } else { Q_SayArgv(1+skiparg, name, sizeof(name)); if( !Q_stricmp( name, "all" ) && (g_legacyShrub.integer==0) ) doAll = qtrue; if( doAll ) { int it; SBP_begin(); SBP(va("^/check : ^7checking all players for god mode\n")); for( it = 0; it < level.numConnectedClients; it++ ) { vic = g_entities + level.sortedClients[it]; if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) continue; if(vic->flags & FL_GODMODE) { count++; netname = vic->client->pers.netname; SBP(va("^dClient ^7%i (%s^7) : ^1god mode detected\n", level.sortedClients[it], netname)); } } if(count==0) AP(va("chat \"^/check: ^2no player is godmoded here\" -1", count)); else AP(va("chat \"^/check: ^1%d players are currently godmoded\" -1", count)); SBP_end(); return qtrue; } if(ClientNumbersFromString(name, pids) != 1) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/check: ^7%s", err)); return qfalse; } vic = &g_entities[pids[0]]; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC("^/check: ^7player must be on a team"); return qfalse; } if(vic->flags & FL_GODMODE) AP(va("chat \"^/check: ^1!!! ^7%s ^7is ^1godmoded !!!\" -1", vic->client->pers.netname)); else AP(va("chat \"^/check: ^7%s ^7is ^2not godmoded\" -1", vic->client->pers.netname)); return qtrue; }