Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/catch.sp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ ConVar gc_bBeginSetV;
ConVar gc_bBeginSetVW;
ConVar gc_bTeleportSpawn;

ConVar gc_fCTSpeed;

// Extern Convars
ConVar g_iTerrorForLR;

Expand Down Expand Up @@ -216,6 +218,8 @@ public void OnPluginStart()
gc_fSprintTime = AutoExecConfig_CreateConVar("sm_catch_sprint_time", "3.0", "Time in seconds the player will sprint", _, true, 1.0);
gc_bAllowLR = AutoExecConfig_CreateConVar("sm_catch_allow_lr", "0", "0 - disabled, 1 - enable LR for last round and end eventday", _, true, 0.0, true, 1.0);
gc_bKillLoser = AutoExecConfig_CreateConVar("sm_catch_kill_loser", "0", "0 - disabled, 1 - Kill loserteam on event end / not for sm_catch_allow_lr '1'", _, true, 0.0, true, 1.0);

gc_fCTSpeed = AutoExecConfig_CreateConVar("sm_catch_ct_speed", "1.4", "Ratio for how fast the CT move", _, true, 0.8);

AutoExecConfig_ExecuteFile();
AutoExecConfig_CleanFile();
Expand Down Expand Up @@ -1458,7 +1462,7 @@ public Action Timer_StartEvent(Handle timer)

if (GetClientTeam(i) == CS_TEAM_CT)
{
SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", 1.4);
SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", gc_fCTSpeed.FloatValue);
}

SetEntityMoveType(i, MOVETYPE_WALK);
Expand Down
9 changes: 6 additions & 3 deletions addons/sourcemod/scripting/MyJailbreak/hide.sp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void OnPluginStart()
gc_bVote = AutoExecConfig_CreateConVar("sm_hide_vote", "1", "0 - disabled, 1 - allow player to vote for hide round", _, true, 0.0, true, 1.0);
gc_bFreezeHider = AutoExecConfig_CreateConVar("sm_hide_freezehider", "1", "0 - disabled, 1 - enable freeze hider when hidetime gone", _, true, 0.0, true, 1.0);
gc_bBlackout = AutoExecConfig_CreateConVar("sm_hide_blackout", "1", "0 - disabled, 1 - enable black out seekers screen on hide time", _, true, 0.0, true, 1.0);
gc_iTAgrenades = AutoExecConfig_CreateConVar("sm_hide_tagrenades", "3", "how many tagrenades a guard have?", _, true, 1.0);
gc_iTAgrenades = AutoExecConfig_CreateConVar("sm_hide_tagrenades", "3", "how many tagrenades a guard have?", _, true, 0.0);

gc_bBeginSetA = AutoExecConfig_CreateConVar("sm_hide_begin_admin", "1", "When admin set event (!sethide) = 0 - start event next round, 1 - start event current round", _, true, 0.0, true, 1.0);
gc_bBeginSetW = AutoExecConfig_CreateConVar("sm_hide_begin_warden", "1", "When warden set event (!sethide) = 0 - start event next round, 1 - start event current round", _, true, 0.0, true, 1.0);
Expand Down Expand Up @@ -810,7 +810,7 @@ public void Event_TA_Detonate(Event event, const char[] name, bool dontBroadcast
return;
}

if (g_iTA[target] != g_iMaxTA)
if (g_iTA[target] < g_iMaxTA)
{
GivePlayerItem(target, "weapon_tagrenade");
int g_iTAgot = (g_iMaxTA - g_iTA[target]);
Expand Down Expand Up @@ -1205,7 +1205,10 @@ void PrepareDay(bool thisround)
}
else if (GetClientTeam(i) == CS_TEAM_CT)
{
GivePlayerItem(i, "weapon_tagrenade");
if (gc_iTAgrenades.BoolValue) // same as gc_iTAgrenades.IntValue != 0
{
GivePlayerItem(i, "weapon_tagrenade");
}

if (gc_bBlackout.BoolValue)
{
Expand Down
93 changes: 89 additions & 4 deletions addons/sourcemod/scripting/MyJailbreak/zombie.sp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ ConVar gc_fBeaconTime;
ConVar gc_iCooldownDay;
ConVar gc_iFreezeTime;
ConVar gc_bSpawnCell;
ConVar gc_bAmmo;
ConVar gc_iAmmo;
ConVar gc_iZombieHP;
ConVar gc_iZombieHPincrease;
ConVar gc_iHumanHP;
Expand Down Expand Up @@ -130,6 +130,7 @@ int g_iTsLR;
Handle g_hTimerFreeze;
Handle g_hTimerBeacon;
Handle g_hTimerRegen;
Handle g_hTimerReplenish;

// floats
float g_fPos[3];
Expand Down Expand Up @@ -191,7 +192,7 @@ public void OnPluginStart()
gc_bTeleportSpawn = AutoExecConfig_CreateConVar("sm_zombie_teleport_spawn", "0", "0 - start event in current round from current player positions, 1 - teleport players to spawn when start event on current round(only when sm_*_begin_admin, sm_*_begin_warden, sm_*_begin_vote or sm_*_begin_daysvote is on '1')", _, true, 0.0, true, 1.0);

gc_bSpawnCell = AutoExecConfig_CreateConVar("sm_zombie_spawn", "0", "0 - T teleport to CT spawn, 1 - cell doors auto open", _, true, 0.0, true, 1.0);
gc_bAmmo = AutoExecConfig_CreateConVar("sm_zombie_ammo", "0", "0 - disabled, 1 - enable infinty ammo (with reload) for humans", _, true, 0.0, true, 1.0);
gc_iAmmo = AutoExecConfig_CreateConVar("sm_zombie_ammo", "0", "0 - disabled, 1 - enable infinite ammo and nades (with reload) for humans, 2 - enable infinite ammo (with reload) for humans", _, true, 0.0, true, 2.0);
gc_iRounds = AutoExecConfig_CreateConVar("sm_zombie_rounds", "1", "Rounds to play in a row", _, true, 1.0);
gc_iRoundTime = AutoExecConfig_CreateConVar("sm_zombie_roundtime", "5", "Round time in minutes for a single zombie round", _, true, 1.0);
gc_fBeaconTime = AutoExecConfig_CreateConVar("sm_zombie_beacon_time", "240", "Time in seconds until the beacon turned on (set to 0 to disable)", _, true, 0.0);
Expand Down Expand Up @@ -227,6 +228,7 @@ public void OnPluginStart()
HookEvent("round_end", Event_RoundEnd_Pre, EventHookMode_Pre);
HookEvent("player_hurt", Event_PlayerHurt);
HookEvent("player_death", Event_PlayerDeath);
HookEvent("weapon_reload", Event_WeaponReload); // sadly, this event is not triggered by auto-reloads (not clicking the reload button)
HookConVarChange(gc_sOverlayStartPath, OnSettingChanged);
HookConVarChange(gc_sModelPathZombie, OnSettingChanged);
HookConVarChange(gc_sSoundStartPath, OnSettingChanged);
Expand Down Expand Up @@ -715,6 +717,7 @@ public void Event_RoundEnd_Pre(Event event, char[] name, bool dontBroadcast)
delete g_hTimerFreeze;
delete g_hTimerBeacon;
delete g_hTimerRegen;
delete g_hTimerReplenish;
g_iFreezeTime = gc_iFreezeTime.IntValue;

int winner = event.GetInt("winner");
Expand Down Expand Up @@ -920,6 +923,7 @@ public void OnMapEnd()
delete g_hTimerFreeze;
delete g_hTimerBeacon;
delete g_hTimerRegen;
delete g_hTimerReplenish;

g_iVoteCount = 0;
g_iRound = 0;
Expand Down Expand Up @@ -992,6 +996,7 @@ void ResetEventDay()
delete g_hTimerFreeze;
delete g_hTimerBeacon;
delete g_hTimerRegen;
delete g_hTimerReplenish;
g_iFreezeTime = gc_iFreezeTime.IntValue;

if (g_iRound == g_iMaxRound)
Expand Down Expand Up @@ -1034,6 +1039,7 @@ public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
SDKHook(client, SDKHook_TraceAttack, OnTraceAttack);
SDKHook(client, SDKHook_WeaponEquipPost, OnWeaponEquipPost);
}

// Knife only for Zombies
Expand Down Expand Up @@ -1075,6 +1081,70 @@ public Action OnTraceAttack(int victim, int &attacker, int &inflictor, float &da
return Plugin_Continue;
}

// Fixes maps that set the ammo of a weapon to 1 or weird values for sm_zombie_ammo 1 and 2
public Action OnWeaponEquipPost(int client, int weapon)
{
if (!g_bIsZombie || !gc_iAmmo.BoolValue)
{
return Plugin_Continue;
}

if (!IsValidClient(client, false, false) || GetClientTeam(client) != CS_TEAM_T)
{
return Plugin_Continue;
}
if (!IsValidEdict(weapon))
{
return Plugin_Continue;
}

// If the weapon isn't a firearm (not a primary or secondary weapon), exit the function.
if (GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) != weapon && GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY) != weapon)
{
return Plugin_Continue;
}

// Gives up to 1k ammo to the player. Caps at the maximum for the weapon.
GivePlayerAmmo(client, 1000, GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType"), true);
return Plugin_Continue;
}

// for "sm_zombie_ammo 2": infinite ammo, without having infinite nades
public void Event_WeaponReload(Event event, const char[] name, bool dontBroadcast)
{
if (!g_bIsZombie || gc_iAmmo.IntValue != 2)
{
return;
}

int client = GetClientOfUserId(event.GetInt("userid"));
ReplenishWeapons(client);
}

// Replenishes a player's weapons if necessary
void ReplenishWeapons(int client)
{
if (!IsValidClient(client, false, false) || GetClientTeam(client) != CS_TEAM_T)
{
return;
}

// Find and replenish the primary weapon if it exists
int weapon = GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY);
if (weapon != -1)
{
GivePlayerAmmo(client, 1000, GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType"), true);
}

// Find and replenish the secondary weapon if it exists
weapon = GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY);
if (weapon != -1)
{
GivePlayerAmmo(client, 1000, GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType"), true);
}
return;
}

/******************************************************************************
FUNCTIONS
******************************************************************************/
Expand Down Expand Up @@ -1246,7 +1316,7 @@ void PrepareDay(bool thisround)
SetCvar("sm_hosties_lr", 0);
}

if (gc_bAmmo.BoolValue)
if (gc_iAmmo.IntValue == 1)
{
SetCvar("sv_infinite_ammo", 2);
}
Expand Down Expand Up @@ -1516,7 +1586,14 @@ public Action Timer_StartEvent(Handle timer)

if (gc_iRegen.IntValue != 0)
{
g_hTimerRegen = CreateTimer(5.0, Timer_ReGenHealth, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
delete g_hTimerRegen;
g_hTimerRegen = CreateTimer(5.0, Timer_ReGenHealth, _, TIMER_REPEAT);
}

if (gc_iAmmo.IntValue == 2)
{
delete g_hTimerReplenish;
g_hTimerReplenish = CreateTimer(5.0, Timer_ReplenishWeapon, _, TIMER_REPEAT);
}

PrintCenterTextAll("%t", "zombie_start_nc");
Expand Down Expand Up @@ -1572,6 +1649,14 @@ public Action Timer_ReGenHealth(Handle timer)
}
}

public Action Timer_ReplenishWeapon(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
ReplenishWeapons(i);
}
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
Expand Down