## 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) g_peaceAndLove : bitflag to disable all damage from weapons. 1 - disable damage 2 - print a message (g_peaceMsg) to the inflictor 4 - play a sound (g_peaceSnd) to the inflictor (needs g_tyranny enabled) 8 - issue a warning after g_peaceDmg damage inflicted (needs shrubbot enabled) 16 - reflect inflicted damage 32 - instagib inflictor g_peaceMsg : see g_peaceAndLove, default "^1Cease fire ! Cease Fire !" g_peaceSnd : see g_peaceAndLove, default "sound/chat/allies/26b.wav" ("Hold your fire" sound from etmain) g_peaceDmg : see g_peaceAndLove, default 300 ------------------------- MODIFICATION STARTS HERE src\game\g_combat.c (line 2031) **** REPLACE // do the damage if( take ) { targ->health -= take; **** WITH // do the damage if( take ) { if(g_peaceAndLove.integer>0 && targ->s.eType == ET_PLAYER && targ->client) { if(!(g_peaceAndLove.integer & PCR_PEACE_NODMG)) targ->health -= take; if(g_peaceAndLove.integer & PCR_PEACE_WARN && g_peaceDmg.integer>50 && g_shrubbot.string[0]) { if(attacker->client->sess.damage_given > g_peaceDmg.integer) { trap_SendConsoleCommand(EXEC_APPEND, va("!warn %i g_peaceAndLove : ^1cease fire now\n", attacker->s.number)); attacker->client->sess.damage_given=0; attacker->client->lastPCRPeace_action=level.time+2000; } } if(attacker->client->lastPCRPeace_actions.number, va("cp \"%s\"",g_peaceMsg.string)); // see #define CPx(x, y) trap_SendServerCommand(x, y) if(g_peaceAndLove.integer & PCR_PEACE_SND && g_tyranny.integer>0 && g_peaceSnd.string[0]) { //G_AddEvent(attacker, EV_GENERAL_SOUND, G_SoundIndex(g_peaceSnd.string)); //G_Printf("playing sound to %i - %i\n", attacker->s.number, attacker->s.teamNum); trap_SendConsoleCommand(EXEC_APPEND, va("playsound %i %s", attacker->s.number, g_peaceSnd.string)); } attacker->client->lastPCRPeace_action=level.time+2000; } if(g_peaceAndLove.integer & PCR_PEACE_REFLECT) { attacker->health -= take; if (attacker->health <=0){ attacker->deathType = MOD_REFLECTED_FF; if (attacker->die){ attacker->enemy = attacker; attacker->die(attacker, attacker, attacker, take, MOD_REFLECTED_FF); } } } if(g_peaceAndLove.integer & PCR_PEACE_GIB && g_tyranny.integer>0 && g_shrubbot.string[0]) { //trap_SendConsoleCommand(EXEC_APPEND, va("!gib %i\n", attacker->s.number)); attacker->health = GIB_HEALTH - 1; AP(va("cpm \"%s ^7was gibbed for breaking ROE.\"", attacker->client->pers.netname)); limbo(attacker, qtrue); } } else targ->health -= take; src\game\g_local.h : (line 957) **** AFTER int lastkilled_client; // last client that this client killed int lasthurt_client; // last client that damaged this client int lasthurt_mod; // type of damage the client did int lasthurt_time; // level.time of last damage int lastrevive_client; int lastkiller_client; int lastammo_client; int lasthealth_client; **** ADD int lastPCRPeace_action; // level.time of last peace measure taken on the client (line 2182) **** AFTER extern vmCvar_t g_spawnInvul; **** ADDED extern vmCvar_t g_peaceAndLove; extern vmCvar_t g_peaceMsg; extern vmCvar_t g_peaceSnd; extern vmCvar_t g_peaceDmg; src\game\g_main.c : (line 259) **** AFTER vmCvar_t g_spawnInvul; **** ADD vmCvar_t g_peaceAndLove; vmCvar_t g_peaceMsg; vmCvar_t g_peaceSnd; vmCvar_t g_peaceDmg; (line 789) **** AFTER { &g_spawnInvul, "g_spawnInvul", "3", 0 }, **** ADD { &g_peaceAndLove, "g_peaceAndLove", "0", 0 }, { &g_peaceMsg, "g_peaceMsg", "^1Cease fire ! Cease Fire !", 0 }, { &g_peaceSnd, "g_peaceSnd", "sound/chat/allies/26b.wav", 0 }, { &g_peaceDmg, "g_peaceDmg", "300", 0 }, src\game\bg_public.h : (line 915) **** AFTER #define MEDIC_NOSELFADREN 256 **** ADD // g_peaceAndLove // disable damage #define PCR_PEACE_NODMG 1 // print a message #define PCR_PEACE_MSG 2 // play a sound #define PCR_PEACE_SND 4 // issue warnings #define PCR_PEACE_WARN 8 // reflect damage #define PCR_PEACE_REFLECT 16 // instagib inflictor #define PCR_PEACE_GIB 32 ------------------------- PERSONAL NOTES // do the damage if( take ) { targ->health -= take; // Gordon: don't ever gib POWS if( ( targ->health <= 0 ) && ( targ->r.svFlags & SVF_POW ) ) { targ->health = -1; } sound/chat/allies/26b.wav if (g_privateMessageSound.string[0]){ gentity_t *tent = G_TempEntity(tmpent->r.currentOrigin, EV_GLOBAL_CLIENT_SOUND); tent->s.teamNum = pids[i]; tent->s.eventParm = G_SoundIndex(va("%s",g_privateMessageSound.string)); } G_AddEvent(vic, EV_GENERAL_SOUND, G_SoundIndex("sound/misc/referee.wav")); // vsay "hold your fire" on the first hit of a teammate // only applies if the player has been hurt before // and the match is not in warmup. if(OnSameTeam(targ, attacker)) { if(!(g_hitsounds.integer & HSF_NO_TEAM_WARN) && (!client->lasthurt_mod || client->lasthurt_client != attacker->s.number) && g_gamestate.integer == GS_PLAYING && !gib) { if(client->sess.sessionTeam == TEAM_AXIS) { snd = G_SoundIndex( g_hitsound_team_warn_axis.string); } } else { s = va("%s %s", "You killed" , targetName ); } trap_SendServerCommand( attacker, va("cp \"%s\"",s)); IN : void G_addStats(gentity_t *targ, gentity_t *attacker, int dmg_ref, int mod) } else { attacker->client->sess.damage_given += dmg; // add commands to the local console as if they were typed in // for map changing, etc. The command is not executed immediately, // but will be executed in order the next time console commands // are processed void trap_SendConsoleCommand( const char *text ); void G_PlaySound_Cmd(void) { char cmd[32] = {"playsound"};