## ETPub PCR alpha hacks (etpub_pcr_ah) ## (C) 2006-2007 PatheticCockroach.com ## This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 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) !clip : FLAG : H (like !heal) g_tyranny : yes USAGE : !clip [name|slot|all] DESCRIPTION : Toggle noclip for the target. If no arg provided it works on self. Also updated !check so that it checks for !clip too. ------------------------- MODIFICATION STARTS HERE src\game\g_shrubbot.c (line 45) **** AFTER {"check", G_shrubbot_check, 'a', 0, "checks if a player is godmoded", SHRUB_PCR_ARG}, **** ADD {"clip", G_shrubbot_clip, 'H', SCMDF_TYRANNY, "toggle noclip", SHRUB_PCR_ARG}, (line 3400) **** BEFORE /* * This function facilitates the SP define. SP() is similar to CP except that * it prints the message to the server console if ent is not defined. */ **** ADD qboolean G_shrubbot_clip(gentity_t *ent, int skiparg) { int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS]; gentity_t *vic; 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("clip: 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; 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->client->noclip) { count++; vic->client->noclip = qfalse; } } if(count==0) AP("chat \"^/clip: ^7all players are already clipped\" -1"); else AP(va("chat \"^/clip: ^8%d player(s) have been reclipped\" -1", count)); return qtrue; } if(ClientNumbersFromString(name, pids) != 1) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/clip: ^7%s", err)); return qfalse; } vic = &g_entities[pids[0]]; } if(!(vic->client->sess.sessionTeam == TEAM_AXIS || vic->client->sess.sessionTeam == TEAM_ALLIES)) { SPC("^/clip: ^7player must be on a team"); return qfalse; } vic->client->noclip = !vic->client->noclip; if(vic->client->noclip) AP(va("chat \"^/clip: ^7%s^7 is now noclipped\" -1", vic->client->pers.netname)); else AP(va("chat \"^/clip: ^7%s^7 is now reclipped\" -1", vic->client->pers.netname)); return qtrue; } src\game\g_shrubbot.h : (line 113) **** AFTER qboolean G_shrubbot_check(gentity_t *ent, int skiparg); **** ADD qboolean G_shrubbot_clip(gentity_t *ent, int skiparg); src\game\g_shrubbot.c **** 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; 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 cheats\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; } **** 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; // count is for !god, count_clip is for !clip int count=0, count_clip=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(vic->client->noclip) { count_clip++; netname = vic->client->pers.netname; SBP(va("^dClient ^7%i (%s^7) : ^8noclip detected\n", level.sortedClients[it], netname)); } } if(count==0) AP("chat \"^/check: ^2no player is godmoded here\" -1"); else AP(va("chat \"^/check: ^1%d players are currently godmoded\" -1", count)); if(count_clip==0) AP("chat \"^/check: ^2no player is noclipped here\" -1"); else AP(va("chat \"^/check: ^8%d players are currently noclipped\" -1", count_clip)); 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)); if(vic->client->noclip) AP(va("chat \"^/check: ^8!!! ^7%s ^7is ^8noclipped !!!\" -1", vic->client->pers.netname)); else AP(va("chat \"^/check: ^7%s ^7is ^2not noclipped\" -1", vic->client->pers.netname)); return qtrue; } **** REPLACE {"check", G_shrubbot_check, 'a', 0, "checks if a player is godmoded", SHRUB_PCR_ARG}, **** WITH {"check", G_shrubbot_check, 'a', 0, "check for cheats (!god, !clip...)", SHRUB_PCR_ARG}, ------------------------- PERSONAL NOTES void Cmd_Noclip_f( gentity_t *ent ) { char *msg; char *name = ConcatArgs( 1 ); if ( !CheatsOk( ent ) ) { return; } if(!Q_stricmp( name, "on" ) || atoi( name ) ) { ent->client->noclip = qtrue; } else if ( !Q_stricmp( name, "off" ) || !Q_stricmp( name, "0" )) { ent->client->noclip = qfalse; } else { ent->client->noclip = !ent->client->noclip; } if ( ent->client->noclip ) { msg = "noclip ON\n"; } else { msg = "noclip OFF\n"; } trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg)); } client = targ->client; if ( client ) { if ( client->noclip || client->ps.powerups[PW_INVULNERABLE] ) { return; } } // check for godmode if ( targ->flags & FL_GODMODE ) { return; }