Skip to content

Commit

Permalink
Leader Rework
Browse files Browse the repository at this point in the history
- cs2f_leader_can_target_players to control whether or not a leader can target other players with c_glow, c_beacon, c_tracer, and c_defend (wont affect admins).
- Make c_glow, c_tracer, c_beacon, and c_defend target @me when used with no parameters or by a leader when cs2f_leader_can_target_players is false.
- Change extra c_glow parameter to color to match c_beacon and c_tracer.
- If all current leaders are zombies or spectators, allow CTs to ping again even when disabled.
- Allow admins to use all leader features even when they aren't a leader.
- If someone is a CT with non-white playermodel color when made leader, use their playermodel color as their leader color instead of a random color from the list. Has a length constraint so dark colors like black aren't used for this and just picks a random color from the list in that case (since the whole idea is being easily visible).
- Make leader commands use ClientPrint instead of ClientPrintAll when a leader uses it on themselves.
- Give leaders access to c_leader for setting more leaders. cs2f_max_leaders controls the max amount of leaders, while admins using c_leader can go above the CVar's limit.
- Make c_vl not work when it would make more than 1 leader if cs2f_leader_vote_multiple is false or if it would make more leaders than cs2f_max_leaders.
- Make c_togglepings, c_enablepings, and c_disablepings for a leader to enable/disable teammate pings (instead of only being hard set by a CVar).
- Automatically beacon to a new leader (disabled glow and tracers) and reapply visuals leader had in previous round  when a new round starts.
- Add c_beacons, c_glows, and c_tracers to check who has them enabled.
- Give leaders +20000 score to show them at top of scoreboard.
- Add a mark particle to CT leader pings.
  • Loading branch information
Frozen-H2O committed Oct 2, 2024
1 parent 10ae171 commit 448b170
Show file tree
Hide file tree
Showing 7 changed files with 583 additions and 531 deletions.
11 changes: 10 additions & 1 deletion cfg/cs2fixes/cs2fixes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,17 @@ zr_infect_shake_duration 5.0 // Duration of shaking effect
cs2f_leader_enable 0 // Whether to enable Leader features
cs2f_leader_vote_ratio 0.15 // Vote ratio needed for player to become a leader
cs2f_leader_actions_ct_only 1 // Whether to allow leader actions (like !beacon) only from human team
cs2f_leader_mute_ping_no_leader 1 // Whether to mute player pings whenever there's no leader
cs2f_leader_mute_player_pings 1 // Whether to mute player pings made by non-leaders
cs2f_leader_model_path "" // Path to player model to be used for leaders
cs2f_leader_defend_particle "particles/cs2fixes/leader_defend_mark.vpcf" // Path to defend particle to be used with c_defend
cs2f_leader_mark_particle "particles/cs2fixes/leader_defend_mark.vpcf" // Path to particle to be used when a ct leader using player_ping
cs2f_leader_can_target_players 0 // Whether a leader can target other players with leader commands (not including c_leader)
cs2f_leader_vote_multiple 1 // If 1, players can vote up to cs2f_max_leaders leaders. If 0, they may vote for a single leader
cs2f_leader_max_leaders 3 // Max amount of leaders set via c_vl or a leader using c_leader (doesn't impact admins)
cs2f_leader_max_markers 6 // Max amount of markers set by leaders (doesn't impact admins)
cs2f_leader_max_glows 3 // Max amount of glows set by leaders (doesn't impact admins)
cs2f_leader_max_tracers 3 // Max amount of tracers set by leaders (doesn't impact admins)
cs2f_leader_max_beacons 3 // Max amount of beacons set by leaders (doesn't impact admins)
// Idle Kick Settings
cs2f_idle_kick_time 0.0 // Amount of minutes before kicking idle players. 0 to disable afk kicking.
Expand Down
23 changes: 22 additions & 1 deletion src/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "entity/lights.h"
#include "playermanager.h"
#include "adminsystem.h"
#include "leader.h"
#include "ctimer.h"
#include "httpmanager.h"
#include "discord.h"
Expand Down Expand Up @@ -273,8 +274,28 @@ bool CChatCommand::CheckCommandAccess(CCSPlayerController *pPlayer, uint64 flags
int slot = pPlayer->GetPlayerSlot();

ZEPlayer *pZEPlayer = g_playerManager->GetPlayer(slot);

if (!pZEPlayer)
return false;

if (!pZEPlayer->IsAdminFlagSet(flags))
if ((flags & FLAG_LEADER) == FLAG_LEADER)
{
if (!g_bEnableLeader)
return false;

if (!pZEPlayer->IsLeader() && !pZEPlayer->IsAdminFlagSet(FLAG_LEADER))
{
ClientPrint(pPlayer, HUD_PRINTTALK, CHAT_PREFIX "You must be a leader to use this command.");
return false;
}

if (g_bLeaderActionsHumanOnly && pPlayer->m_iTeamNum != CS_TEAM_CT)
{
ClientPrint(pPlayer, HUD_PRINTTALK, CHAT_PREFIX "You must be a human to use this command.");
return false;
}
}
else if (!pZEPlayer->IsAdminFlagSet(flags))
{
ClientPrint(pPlayer, HUD_PRINTTALK, CHAT_PREFIX "You don't have access to this command.");
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "entity/ccsplayercontroller.h"
#include "convar.h"
#include "adminsystem.h"
#include "leader.h"
#include <vector>

#define CMDFLAG_NONE (0)
Expand Down Expand Up @@ -124,3 +125,4 @@ void ParseChatCommand(const char *, CCSPlayerController *);
void name##_callback(const CCommand &args, CCSPlayerController *player)

#define CON_COMMAND_CHAT(name, description) CON_COMMAND_CHAT_FLAGS(name, description, ADMFLAG_NONE)
#define CON_COMMAND_CHAT_LEADER(name, description) CON_COMMAND_CHAT_FLAGS(name, description, FLAG_LEADER)
Loading

0 comments on commit 448b170

Please sign in to comment.