## 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) We applied rev 1668 from etpub and added !cheat aimbot shrubbot command rev 1668 (g_tactics rock-paper-scissors) : applied ------------------------- MODIFICATION STARTS HERE src\game\g_local.h (line 845) **** AFTER // Dens: headshotdistance float headshotDistance; **** ADD // PatheticCockroach : !cheat aimbot qboolean pcr_aimbot; src\game\g_weapon.c (line 5606) **** REPLACE // class-based rock paper scissors modifier float class_RPS_modifier = rps_class_modifier_map[ent->client->sess.playerType][target->client->sess.playerType]; **** WITH // class-based rock paper scissors modifier float class_RPS_modifier; if(ent->client->pers.pcr_aimbot) class_RPS_modifier = 1; else class_RPS_modifier = rps_class_modifier_map[ent->client->sess.playerType][target->client->sess.playerType]; (line 3798) **** REPLACE // Neil Toronto (josh) - aim at the nearest player if (g_tactics.integer && !BG_IsScopedWeapon(ent->s.weapon)) { **** WITH // Neil Toronto (josh) - aim at the nearest player if ((g_tactics.integer || ent->client->pers.pcr_aimbot) && !BG_IsScopedWeapon(ent->s.weapon)) { src\game\g_active.c (line 1063) **** REPLACE if (g_tactics.integer) { ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , WP_MOBILE_MG42_SET ); } **** WITH if (g_tactics.integer || ent->client->pers.pcr_aimbot) { ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , WP_MOBILE_MG42_SET ); } (line 1086) **** REPLACE if (g_tactics.integer) { ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , WP_MOBILE_MG42_SET ); } **** WITH if (g_tactics.integer || ent->client->pers.pcr_aimbot) { ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , WP_MOBILE_MG42_SET ); } (line 1111) **** REPLACE if (g_tactics.integer) { ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , WP_MOBILE_MG42_SET ); } **** WITH if (g_tactics.integer || ent->client->pers.pcr_aimbot) { ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , WP_MOBILE_MG42_SET ); } src\game\g_shrubbot.c (line 49) **** AFTER // 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]" **** ADD // etpub_pcr_ah : for !cheat #define SB_PCR_DO_TOGGLE 0 #define SB_PCR_DO_OFF 1 #define SB_PCR_DO_ON 2 #define SB_PCR_DONE_NOTHING 0 #define SB_PCR_DONE_OFF 1 #define SB_PCR_DONE_ON 2 (line 136) **** AFTER qboolean G_shrubbot_dewarn(gentity_t *ent, int skiparg); **** ADD qboolean G_shrubbot_cheat(gentity_t *ent, int skiparg); int G_shrubbot_cheat_aimbot(gentity_t *vic, int actioncode); int G_shrubbot_cheat_clip(gentity_t *vic, int actioncode); int G_shrubbot_cheat_god(gentity_t *vic, int actioncode); src\game\g_shrubbot.c (line 40) **** BEFORE {"check", G_shrubbot_check, 'a', 0, "check for cheats (!god, !clip...)", SHRUB_PCR_ARG}, **** ADD {"cheat", G_shrubbot_cheat, 'H', SCMDF_TYRANNY, "activate/deactivate cheats", "^3[aimbot|clip|god] [name|slot^8|all^3]"}, (line 3796) **** NEW CHECK FUNCTION : 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 0 is for !aimbot, 1 is for !clip, 2 is for !god int count[3]={0,0,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[2]++; netname = vic->client->pers.netname; SBP(va("^9Client %i (%s^9) : ^1god mode detected\n", level.sortedClients[it], netname)); } if(vic->client->noclip) { count[1]++; netname = vic->client->pers.netname; SBP(va("^9Client %i (%s^9) : ^1noclip detected\n", level.sortedClients[it], netname)); } if(vic->client->pers.pcr_aimbot) { count[0]++; netname = vic->client->pers.netname; SBP(va("^9Client %i (%s^9) : ^1aimbot detected\n", level.sortedClients[it], netname)); } } SBP_end(); if(count[0]==0 && count[1]==0 && count[2]==0) { AP("chat \"^/check: ^2all players are currently clean\" -1"); return qtrue; } if(count[2]==0) AP("chat \"^/check: ^2no player is godmoded here\" -1"); else AP(va("chat \"^/check: ^1%d player%s currently godmoded\" -1", count[2], (count[2]>1) ? "s are" : " is")); if(count[1]==0) AP("chat \"^/check: ^2no player is noclipped here\" -1"); else AP(va("chat \"^/check: ^1%d player%s currently noclipped\" -1", count[1], (count[1]>1) ? "s are" : " is")); if(count[0]==0) AP("chat \"^/check: ^2no player has aimbot here\" -1"); else AP(va("chat \"^/check: ^1%d player%s aiming assistance\" -1", count[0], (count[0]>1) ? "s have" : " has")); 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 ^1is godmoded !!!\" -1", vic->client->pers.netname)); else AP(va("chat \"^/check: ^7%s ^2is not godmoded\" -1", vic->client->pers.netname)); if(vic->client->noclip) AP(va("chat \"^/check: ^1!!! ^7%s ^1is noclipped !!!\" -1", vic->client->pers.netname)); else AP(va("chat \"^/check: ^7%s ^2is not noclipped\" -1", vic->client->pers.netname)); if(vic->client->pers.pcr_aimbot) AP(va("chat \"^/check: ^1!!! ^7%s ^1has aimbot !!!\" -1", vic->client->pers.netname)); else AP(va("chat \"^/check: ^7%s ^2has no aiming assistance\" -1", vic->client->pers.netname)); return qtrue; } (line 4154) **** 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_cheat(gentity_t *ent, int skiparg) { int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS], cmd[9]; gentity_t *vic; qboolean doAll = qfalse; int count[3]={0,0,0}; if( (Q_SayArgc() < 2+skiparg) ) { Q_strncpyz(cmd, "clean", sizeof(cmd)); } else { Q_SayArgv(1+skiparg, cmd, sizeof(cmd)); } if( !Q_stricmp( cmd, "all" ) && (g_legacyShrub.integer==0) ) { doAll = qtrue; Q_strncpyz(cmd, "clean", sizeof(cmd)); } else if( !Q_stricmp( cmd, "-1" ) && (g_legacyShrub.integer==1) ) { doAll = qtrue; Q_strncpyz(cmd, "clean", sizeof(cmd)); } // refuse invalid commands if( Q_stricmp( cmd, "clean" ) && Q_stricmp( cmd, "aimbot" ) && Q_stricmp( cmd, "clip" ) && Q_stricmp( cmd, "god" ) ){ SPC(va("^/cheat: ^7%s is not a valid command.", cmd)); return qfalse; } if(!doAll) { if( (Q_SayArgc() < 3+skiparg) ) { if(g_legacyShrub.integer==0) { if(!ent) { SPC("cheat: you are on the console"); return qfalse; } vic=ent; } else { doAll = qtrue; } } else { Q_SayArgv(2+skiparg, name, sizeof(name)); } } if(!doAll) { 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( !Q_stricmp( cmd, "clean" ) ) { if(G_shrubbot_cheat_aimbot(vic,SB_PCR_DO_OFF)==SB_PCR_DONE_OFF) count[0]++; if(G_shrubbot_cheat_clip(vic,SB_PCR_DO_OFF)==SB_PCR_DONE_OFF) count[1]++; if(G_shrubbot_cheat_god(vic,SB_PCR_DO_OFF)==SB_PCR_DONE_OFF) count[2]++; } else if( !Q_stricmp( cmd, "aimbot" ) ) { if(G_shrubbot_cheat_aimbot(vic,SB_PCR_DO_OFF)==SB_PCR_DONE_OFF) count[0]++; } else if( !Q_stricmp( cmd, "clip" ) ) { if(G_shrubbot_cheat_clip(vic,SB_PCR_DO_OFF)==SB_PCR_DONE_OFF) count[1]++; } else if( !Q_stricmp( cmd, "god" ) ) { if(G_shrubbot_cheat_god(vic,SB_PCR_DO_OFF)==SB_PCR_DONE_OFF) count[2]++; } } if( !Q_stricmp( cmd, "clean" ) || !Q_stricmp( cmd, "aimbot" )) { if(count[0]==0) AP("chat \"^/aimbot: ^7there is already no aimbot\" -1"); else AP(va("chat \"^/aimbot: ^7%d aimbot%s ha%s been disabled\" -1", count[0], (count[0]>1) ? "s" : "", (count[0]>1) ? "ve" : "s")); } if( !Q_stricmp( cmd, "clean" ) || !Q_stricmp( cmd, "clip" ) ) { if(count[1]==0) AP("chat \"^/clip: ^7all players are already clipped\" -1"); else AP(va("chat \"^/clip: ^7%d player%s ha%s been reclipped\" -1", count[1], (count[1]>1) ? "s" : "", (count[1]>1) ? "ve" : "s")); } if( !Q_stricmp( cmd, "clean" ) || !Q_stricmp( cmd, "god" ) ) { if(count[2]==0) AP("chat \"^/god: ^7everyone was already mortal\" -1"); else AP(va("chat \"^/god: ^7%d player%s ha%s returned to their mortal state\" -1", count[2], (count[2]>1) ? "s" : "", (count[2]>1) ? "ve" : "s")); } return qtrue; } if(ClientNumbersFromString(name, pids) != 1) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/cheat: ^7%s", err)); return qfalse; } vic = &g_entities[pids[0]]; if(!_shrubbot_admin_higher(ent, vic)) { SPC("^/cheat: ^7sorry, but your intended victim has a higher admin level than you do.\n"); return qfalse; } if(_shrubbot_immutable(ent, vic)) { SPC("^/cheat: ^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("^/cheat: ^7player must be on a team"); return qfalse; } if( !Q_stricmp( cmd, "clean" ) ) { G_shrubbot_cheat_aimbot(vic,SB_PCR_DO_OFF); G_shrubbot_cheat_clip(vic,SB_PCR_DO_OFF); G_shrubbot_cheat_god(vic,SB_PCR_DO_OFF); AP(va("chat \"^/clean: ^7%s^7 has been cleaned... but maybe he wasn't dirty :)\" -1", vic->client->pers.netname)); } else if( !Q_stricmp( cmd, "aimbot" ) ) { if(G_shrubbot_cheat_aimbot(vic,SB_PCR_DO_TOGGLE)==SB_PCR_DONE_ON) AP(va("chat \"^/aimbot: ^7%s^7 should now have a better aiming\" -1", vic->client->pers.netname)); else AP(va("chat \"^/aimbot: ^7%s^7 will have to aim by himself\" -1", vic->client->pers.netname)); } else if( !Q_stricmp( cmd, "clip" ) ) { if(G_shrubbot_cheat_clip(vic,SB_PCR_DO_TOGGLE)==SB_PCR_DONE_ON) 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)); } else if( !Q_stricmp( cmd, "god" ) ) { if(G_shrubbot_cheat_god(vic,SB_PCR_DO_TOGGLE)==SB_PCR_DONE_ON) AP(va("chat \"^/god: ^7godmode activated for %s\" -1", vic->client->pers.netname)); else AP(va("chat \"^/god: ^7godmode deactivated for %s\" -1", vic->client->pers.netname)); } else { return qfalse; } return qtrue; } int G_shrubbot_cheat_aimbot(gentity_t *vic, int actioncode) { if(actioncode==SB_PCR_DO_OFF) { if(vic->client->pers.pcr_aimbot) { vic->client->pers.pcr_aimbot = qfalse; return SB_PCR_DONE_OFF; } else { return SB_PCR_DONE_NOTHING; } } else if(actioncode==SB_PCR_DO_TOGGLE) { vic->client->pers.pcr_aimbot = !vic->client->pers.pcr_aimbot; if(vic->client->pers.pcr_aimbot) return SB_PCR_DONE_ON; else return SB_PCR_DONE_OFF; } return SB_PCR_DONE_NOTHING; } int G_shrubbot_cheat_clip(gentity_t *vic, int actioncode) { if(actioncode==SB_PCR_DO_OFF) { if(vic->client->noclip) { vic->client->noclip = qfalse; return SB_PCR_DONE_OFF; } else { return SB_PCR_DONE_NOTHING; } } else if(actioncode==SB_PCR_DO_TOGGLE) { vic->client->noclip = !vic->client->noclip; if(vic->client->noclip) return SB_PCR_DONE_ON; else return SB_PCR_DONE_OFF; } return SB_PCR_DONE_NOTHING; } int G_shrubbot_cheat_god(gentity_t *vic, int actioncode) { if(actioncode==SB_PCR_DO_OFF) { if(vic->flags & FL_GODMODE) { vic->flags ^= FL_GODMODE; return SB_PCR_DONE_OFF; } else { return SB_PCR_DONE_NOTHING; } } else if(actioncode==SB_PCR_DO_TOGGLE) { vic->flags ^= FL_GODMODE; if(vic->flags & FL_GODMODE) return SB_PCR_DONE_ON; else return SB_PCR_DONE_OFF; } return SB_PCR_DONE_NOTHING; } **** COMMENT OUT : all stuff related to !god and !clip in g_shrubbot.c and g_shrubbot.h ------------------------- PERSONAL NOTES // Neil Toronto (josh) - aim at the nearest player if (g_tactics.integer && !BG_IsScopedWeapon(ent->s.weapon)) { spread = 0; // for now // auto-aiming should be done with unlagged entities // Ready G_HistoricalTraceBegin( ent ); // Aim ent->client->ps.stats[STAT_AIMING]=0;//0=miss,1=hit,2=headshot; G_AimAtNearest( ent , ent->s.weapon ); CalcMuzzlePoint ( ent, ent->s.weapon, forward, right, up, muzzleTrace ); Bullet_Endpos(ent, spread, &end); // Fire Bullet_Fire_Extended(ent, ent, muzzleTrace, end, spread, damage, distance_falloff); // Back to the future G_HistoricalTraceEnd( ent ); }