Skip to content

Commit

Permalink
Cvar to control the icon on the death event for infection.
Browse files Browse the repository at this point in the history
  • Loading branch information
JMorell authored and maxime1907 committed Jul 15, 2022
1 parent 3f75906 commit d0e4eb5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions csgo/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ zr_infect_shake_frequency "1.0"
// Default: "5.0"
zr_infect_shake_duration "5.0"
// Weapon icon used when the death event is sent for a player that gets infected.
// Default: "zombie_claws_of_death"
zr_infect_event_weapon "zombie_claws_of_death"
// ----------------------------------------------------------------------------
// Damage (core)
Expand Down
3 changes: 3 additions & 0 deletions cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ zr_infect_shake_frequency "1.0"
// Default: "5.0"
zr_infect_shake_duration "5.0"
// Weapon icon used when the death event is sent for a player that gets infected.
// Default: "zombie_claws_of_death"
zr_infect_event_weapon "zombie_claws_of_death"
// ----------------------------------------------------------------------------
// Damage (core)
Expand Down
3 changes: 2 additions & 1 deletion src/zr/cvars.inc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ enum struct CvarsList
Handle CVAR_INFECT_SHAKE_AMP;
Handle CVAR_INFECT_SHAKE_FREQUENCY;
Handle CVAR_INFECT_SHAKE_DURATION;
Handle CVAR_INFECT_EVENT_WEAPON;
Handle CVAR_ACCOUNT_CASHFILL;
Handle CVAR_ACCOUNT_CASHFILL_VALUE;
Handle CVAR_ACCOUNT_CASHDMG;
Expand Down Expand Up @@ -359,7 +360,7 @@ CvarsCreate()
g_hCvarsList.CVAR_INFECT_SHAKE_AMP = CreateConVar("zr_infect_shake_amp", "15.0", "Amplitude of shaking effect. [Dependency: zr_infect_shake]");
g_hCvarsList.CVAR_INFECT_SHAKE_FREQUENCY = CreateConVar("zr_infect_shake_frequency", "1.0", "Frequency of shaking effect. [Dependency: zr_infect_shake]");
g_hCvarsList.CVAR_INFECT_SHAKE_DURATION = CreateConVar("zr_infect_shake_duration", "5.0", "Duration of shaking effect. [Dependency: zr_infect_shake]");

g_hCvarsList.CVAR_INFECT_EVENT_WEAPON = CreateConVar("zr_infect_event_weapon", "zombie_claws_of_death", "Weapon icon used when the death event is sent for a player that gets infected.");

// ===========================
// Damage (core)
Expand Down
12 changes: 11 additions & 1 deletion src/zr/infect.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ new bool:g_TeamManagerLoaded = false;
#define EXP_NODLIGHTS 1024
#define EXP_NOCLAMPMIN 2048
#define EXP_NOCLAMPMAX 4096
/**
* @endsection
*/

/**
* @section Other defines.
*/
#define MAX_EVENT_LENGTH 32
/**
* @endsection
*/
Expand Down Expand Up @@ -994,9 +1002,11 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
new Handle:event = CreateEvent("player_death");
if (event != INVALID_HANDLE)
{
char eventWeapon[MAX_EVENT_LENGTH];
GetConVarString(g_hCvarsList[CVAR_INFECT_EVENT_WEAPON], eventWeapon, MAX_EVENT_LENGTH);
SetEventInt(event, "userid", GetClientUserId(client));
SetEventInt(event, "attacker", GetClientUserId(attacker));
SetEventString(event, "weapon", "zombie_claws_of_death");
SetEventString(event, "weapon", eventWeapon);
FireEvent(event, false);
}

Expand Down

0 comments on commit d0e4eb5

Please sign in to comment.