Skip to content

Commit

Permalink
Make myjailbreak optional again #314 mmoa
Browse files Browse the repository at this point in the history
  • Loading branch information
shanapu committed Dec 29, 2018
1 parent bd6bdb3 commit dd0b3d4
Show file tree
Hide file tree
Showing 34 changed files with 463 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ int GetRandomAdmin()
if (!IsValidClient(i, false, true))
continue;

if (!MyJailbreak_CheckVIPFlags(i, "sm_freekill_flag", gc_sAdminFlag, "sm_freekill_flag"))
if (!MyJB_CheckVIPFlags(i, "sm_freekill_flag", gc_sAdminFlag, "sm_freekill_flag"))
continue;

admins[adminsCount++] = i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void Heal_Event_RoundStart(Event event, char[] name, bool dontBroadcast)
g_iHealCounter[i] = 0;
g_bHealed[i] = false;

if (MyJailbreak_CheckVIPFlags(i, "sm_heal_flag", gc_sAdminFlagHeal, "sm_heal_flag"))
if (MyJB_CheckVIPFlags(i, "sm_heal_flag", gc_sAdminFlagHeal, "sm_heal_flag"))
{
g_iHealCounter[i] = -1;
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public void Heal_OnClientPutInServer(int client)
{
g_iHealCounter[client] = 0;

if (MyJailbreak_CheckVIPFlags(client, "sm_heal_flag", gc_sAdminFlagHeal, "sm_heal_flag"))
if (MyJB_CheckVIPFlags(client, "sm_heal_flag", gc_sAdminFlagHeal, "sm_heal_flag"))
{
g_iHealCounter[client] = -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void Refuse_Event_RoundStart(Event event, char[] name, bool dontBroadcast
g_bRefused[i] = false;
g_bAllowRefuse = false;

if (MyJailbreak_CheckVIPFlags(i, "sm_refuse_flag", gc_sAdminFlagRefuse, "sm_refuse_flag"))
if (MyJB_CheckVIPFlags(i, "sm_refuse_flag", gc_sAdminFlagRefuse, "sm_refuse_flag"))
{
g_iRefuseCounter[i] = -1;
}
Expand Down Expand Up @@ -232,7 +232,7 @@ public void Refuse_OnClientPutInServer(int client)
{
g_iRefuseCounter[client] = 0;

if (MyJailbreak_CheckVIPFlags(client, "sm_refuse_flag", gc_sAdminFlagRefuse, "sm_refuse_flag"))
if (MyJB_CheckVIPFlags(client, "sm_refuse_flag", gc_sAdminFlagRefuse, "sm_refuse_flag"))
{
g_iRefuseCounter[client] = -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void Repeat_Event_RoundStart(Event event, char[] name, bool dontBroadcast
g_bRepeated[i] = false;
g_iRepeatCounter[i] = 0;

if (MyJailbreak_CheckVIPFlags(i, "sm_repeat_flag", gc_sAdminFlagRepeat, "sm_repeat_flag"))
if (MyJB_CheckVIPFlags(i, "sm_repeat_flag", gc_sAdminFlagRepeat, "sm_repeat_flag"))
{
g_iRepeatCounter[i] = -1;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public void Repeat_OnClientPutInServer(int client)
{
g_iRepeatCounter[client] = 0;

if (MyJailbreak_CheckVIPFlags(client, "sm_repeat_flag", gc_sAdminFlagRepeat, "sm_repeat_flag"))
if (MyJB_CheckVIPFlags(client, "sm_repeat_flag", gc_sAdminFlagRepeat, "sm_repeat_flag"))
{
g_iRepeatCounter[client] = -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Action BackStab_OnTakedamage(int victim, int &attacker, int &inflictor, f

if (IsClientWarden(victim) || (IsClientDeputy(victim) && gc_bBackstabDeputy.BoolValue))
{
if (!MyJailbreak_CheckVIPFlags(victim, "sm_warden_backstab_flag", gc_sAdminFlagBackstab, "sm_warden_backstab_flag"))
if (!MyJB_CheckVIPFlags(victim, "sm_warden_backstab_flag", gc_sAdminFlagBackstab, "sm_warden_backstab_flag"))
return Plugin_Continue;

char sWeapon[32];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Action Command_BulletSparks(int client, int args)
if (!gc_bPlugin.BoolValue || !g_bEnabled || !gc_bBulletSparks.BoolValue)
return Plugin_Handled;

if (!MyJailbreak_CheckVIPFlags(client, "sm_warden_bulletsparks_flag", gc_sAdminFlagBulletSparks, "sm_warden_bulletsparks_flag"))
if (!MyJB_CheckVIPFlags(client, "sm_warden_bulletsparks_flag", gc_sAdminFlagBulletSparks, "sm_warden_bulletsparks_flag"))
return Plugin_Handled;

if (IsClientWarden(client) || (IsClientDeputy(client) && gc_bBulletSparksDeputy.BoolValue))
Expand Down Expand Up @@ -103,7 +103,7 @@ public Action BulletSparks_Event_BulletImpact(Event event, char[] sName, bool bD
if (!gc_bPlugin.BoolValue || !g_bEnabled || !gc_bBulletSparks.BoolValue || !g_bBulletSparks[client])
return Plugin_Continue;

if (!MyJailbreak_CheckVIPFlags(client, "sm_warden_bulletsparks_flag", gc_sAdminFlagBulletSparks, "sm_warden_bulletsparks_flag"))
if (!MyJB_CheckVIPFlags(client, "sm_warden_bulletsparks_flag", gc_sAdminFlagBulletSparks, "sm_warden_bulletsparks_flag"))
return Plugin_Continue;

if (IsClientWarden(client) || (IsClientDeputy(client) && gc_bBulletSparksDeputy.BoolValue))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void CuffsEm(int client, int attacker)

CPrintToChatAll("%s %t", g_sPrefix, "warden_cuffson", attacker, client);
CPrintToChat(attacker, "%s %t", g_sPrefix, "warden_cuffsgot", g_iPlayerHandCuffs[attacker]);
if (MyJailbreak_CheckVIPFlags(client, "sm_warden_handcuffs_flag", gc_sAdminFlagCuffs, "sm_warden_handcuffs_flag"))
if (MyJB_CheckVIPFlags(client, "sm_warden_handcuffs_flag", gc_sAdminFlagCuffs, "sm_warden_handcuffs_flag"))
{
CreateTimer (2.5, Timer_HasPaperClip, client);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Action Command_LaserMenu(int client, int args)
{
if (IsClientWarden(client) || (IsClientDeputy(client) && gc_bLaserDeputy.BoolValue))
{
if (MyJailbreak_CheckVIPFlags(client, "sm_warden_laser_flag", gc_sAdminFlagLaser, "sm_warden_laser_flag"))
if (MyJB_CheckVIPFlags(client, "sm_warden_laser_flag", gc_sAdminFlagLaser, "sm_warden_laser_flag"))
{
char menuinfo[255];
Menu menu = new Menu(Handler_LaserMenu);
Expand Down Expand Up @@ -146,7 +146,7 @@ public Action Laser_OnPlayerRunCmd(int client, int &buttons, int &impulse, float
if (!IsValidClient(client, true, true))
return Plugin_Continue;

if (!MyJailbreak_CheckVIPFlags(client, "sm_warden_laser_flag", gc_sAdminFlagLaser, "sm_warden_laser_flag"))
if (!MyJB_CheckVIPFlags(client, "sm_warden_laser_flag", gc_sAdminFlagLaser, "sm_warden_laser_flag"))
return Plugin_Continue;

// g_bLaserUse[client] = true;
Expand Down
8 changes: 4 additions & 4 deletions addons/sourcemod/scripting/MyJailbreak/Modules/Warden/mute.sp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void Mute_Event_RoundStart(Event event, const char[] name, bool dontBroad
if (!IsValidClient(i, true, true))
continue;

if (MyJailbreak_CheckVIPFlags(i, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
if (MyJB_CheckVIPFlags(i, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
continue;

if (GetClientTeam(i) != CS_TEAM_CT)
Expand Down Expand Up @@ -252,7 +252,7 @@ public void OnClientSpeakingEx(int client)
if (!IsValidClient(i, true, true))
continue;

if (MyJailbreak_CheckVIPFlags(i, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
if (MyJB_CheckVIPFlags(i, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
continue;

if ((GetClientTeam(i) != CS_TEAM_CT) && (!g_bIsMuted[i] || (GetClientListeningFlags(i) != VOICE_MUTED)) ||
Expand Down Expand Up @@ -316,7 +316,7 @@ void MuteClient(int client, int time, int muter)
if (!IsValidClient(client, true, true))
return;

if (MyJailbreak_CheckVIPFlags(client, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
if (MyJB_CheckVIPFlags(client, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
return;

if (GetClientTeam(client) != CS_TEAM_CT)
Expand Down Expand Up @@ -407,7 +407,7 @@ void MuteMenuPlayer(int client)
if (!IsValidClient(i, true, true))
continue;

if (MyJailbreak_CheckVIPFlags(i, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
if (MyJB_CheckVIPFlags(i, "sm_warden_mute_immuntiy", gc_sAdminFlagMute, "sm_warden_mute_immuntiy"))
continue;

if ((GetClientTeam(i) != CS_TEAM_CT) && !g_bIsMuted[i])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Action Command_PainterMenu(int client, int args)
{
if ((IsClientWarden(client)) || (IsClientDeputy(client) && gc_bPainterDeputy.BoolValue) || ((GetClientTeam(client) == CS_TEAM_T) && g_bPainterT))
{
if (MyJailbreak_CheckVIPFlags(client, "sm_warden_painter_flag", gc_sAdminFlagPainter, "sm_warden_painter_flag") || (GetClientTeam(client) == CS_TEAM_T))
if (MyJB_CheckVIPFlags(client, "sm_warden_painter_flag", gc_sAdminFlagPainter, "sm_warden_painter_flag") || (GetClientTeam(client) == CS_TEAM_T))
{
char menuinfo[255];

Expand Down Expand Up @@ -181,7 +181,7 @@ public Action Painter_OnPlayerRunCmd(int client, int &buttons, int &impulse, flo
if (!IsPlayerAlive(client))
return;

if ((IsClientWarden(client) && gc_bPainter.BoolValue && g_bPainter[client] && MyJailbreak_CheckVIPFlags(client, "sm_warden_painter_flag", gc_sAdminFlagPainter, "sm_warden_painter_flag")) || ((GetClientTeam(client) == CS_TEAM_T) && gc_bPainter.BoolValue && g_bPainterT && g_bPainter[client]) || (IsClientDeputy(client) && gc_bPainterDeputy.BoolValue && g_bPainter[client]))
if ((IsClientWarden(client) && gc_bPainter.BoolValue && g_bPainter[client] && MyJB_CheckVIPFlags(client, "sm_warden_painter_flag", gc_sAdminFlagPainter, "sm_warden_painter_flag")) || ((GetClientTeam(client) == CS_TEAM_T) && gc_bPainter.BoolValue && g_bPainterT && g_bPainter[client]) || (IsClientDeputy(client) && gc_bPainterDeputy.BoolValue && g_bPainter[client]))
{
for (int i = 0; i < MAX_BUTTONS; i++)
{
Expand Down
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/armsrace.sp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public Action Command_Setarmsrace(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event armsrace was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_armsrace_flag", gc_sAdminFlag, "sm_armsrace_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_armsrace_flag", gc_sAdminFlag, "sm_armsrace_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1301,3 +1301,19 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)

return Plugin_Handled;
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/catch.sp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public Action Command_SetCatch(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event Catch was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_catch_flag", gc_sAdminFlag, "sm_catch_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_catch_flag", gc_sAdminFlag, "sm_catch_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1656,4 +1656,20 @@ public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast

ResetSprint(client);
g_iSprintStatus[client] &= ~ IsSprintCoolDown;
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/cowboy.sp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public Action Command_SetCowBoy(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event CowBoy was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_cowboy_flag", gc_sAdminFlag, "sm_cowboy_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_cowboy_flag", gc_sAdminFlag, "sm_cowboy_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1193,4 +1193,20 @@ public Action Timer_Hitsound(Handle timer, Handle data)
if (attacker <= 0 || attacker > MaxClients || victim <= 0 || victim > MaxClients || attacker == victim)
return;
ClientCommand(attacker, "playgamesound training/bell_normal.wav");
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/dealdamage.sp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public Action Command_SetDealDamage(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event Deal Damage was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_dealdamage_flag", gc_sAdminFlag, "sm_dealdamage_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_dealdamage_flag", gc_sAdminFlag, "sm_dealdamage_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1591,3 +1591,19 @@ public Action Timer_Overlay(Handle timer, int client)
}
}
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/drunk.sp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public Action Command_SetDrunk(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event Drunk was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_drunk_flag", gc_sAdminFlag, "sm_drunk_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_drunk_flag", gc_sAdminFlag, "sm_drunk_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1165,4 +1165,20 @@ public Action Timer_Drunk(Handle timer, int userid)
}

return Plugin_Handled;
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
Expand Down
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/duckhunt.sp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public Action Command_SetDuckHunt(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event duckhunt was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_duckhunt_flag", gc_sAdminFlag, "sm_duckhunt_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_duckhunt_flag", gc_sAdminFlag, "sm_duckhunt_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1412,4 +1412,20 @@ public Action Timer_BeaconOn(Handle timer)
}

g_hTimerBeacon = null;
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/MyJailbreak/ffa.sp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public Action Command_Setffa(int client, int args)
LogToFileEx(g_sEventsLogFile, "Event ffa was started by groupvoting");
}
}
else if (MyJailbreak_CheckVIPFlags(client, "sm_ffa_flag", gc_sAdminFlag, "sm_ffa_flag")) // Called by admin/VIP
else if (MyJB_CheckVIPFlags(client, "sm_ffa_flag", gc_sAdminFlag, "sm_ffa_flag")) // Called by admin/VIP
{
if (!gc_bSetA.BoolValue)
{
Expand Down Expand Up @@ -1088,4 +1088,20 @@ public Action Timer_BeaconOn(Handle timer)
}

g_hTimerBeacon = null;
}

bool MyJB_CheckVIPFlags(int client, const char[] command, ConVar flags, char[] feature)
{
if (gp_bMyJailbreak)
return MyJailbreak_CheckVIPFlags(client, command, flags, feature);

char sBuffer[32];
flags.GetString(sBuffer, sizeof(sBuffer));

if (strlen(sBuffer) == 0) // ???
return true;

int iFlags = ReadFlagString(sBuffer);

return CheckCommandAccess(client, command, iFlags);
}
Loading

0 comments on commit dd0b3d4

Please sign in to comment.