Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
oqyh committed Mar 23, 2024
1 parent dab1614 commit 61e247d
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 20 deletions.
57 changes: 54 additions & 3 deletions Config/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ public int VoteKick_Mode
}
}
}



public int VoteKick_TimeInMins { get; set; }
public int VoteKick_StartOnMinimumOfXPlayers { get; set; }
public bool VoteKick_AllowKickedPlayersToJoinOnMapChange { get; set; }
public bool VoteKick_TeamOnly { get; set; }
public float VoteKick_Percentage { get; set; }
Expand All @@ -116,12 +114,50 @@ public int VoteKick_Mode
public string VoteKick_CommandsOnHalfVoteAccept { get; set; }
public string VoteKick_CommandsOnHalfVoteRefuse { get; set; }
public string VoteKick_ImmunityGroups { get; set; }

public string empty { get; set; }


private int _voteBannedMode;
public int VoteBanned_Mode
{
get => _voteBannedMode;
set
{
_voteBannedMode = value;
if (_voteBannedMode < 0 || _voteBannedMode > 3)
{
VoteBanned_Mode = 0;
Console.WriteLine("|||||||||||||||||||||||||||||||||||||||||||||||| I N V A L I D ||||||||||||||||||||||||||||||||||||||||||||||||");
Console.WriteLine("[Vote-GoldKingZ] VoteBanned_Mode: is invalid, setting to default value (0) Please Choose 0 or 1 or 2 or 3.");
Console.WriteLine("[Vote-GoldKingZ] VoteBanned_Mode (0) = Disable");
Console.WriteLine("[Vote-GoldKingZ] VoteBanned_Mode (1) = Banned And Restrict SteamID From Joining");
Console.WriteLine("[Vote-GoldKingZ] VoteBanned_Mode (2) = Banned And Restrict IpAddress From Joining");
Console.WriteLine("[Vote-GoldKingZ] VoteBanned_Mode (3) = Banned And Restrict SteamID And IpAddress From Joining");
Console.WriteLine("|||||||||||||||||||||||||||||||||||||||||||||||| I N V A L I D ||||||||||||||||||||||||||||||||||||||||||||||||");
}
}
}
public int VoteBanned_TimeInDays { get; set; }
public int VoteBanned_StartOnMinimumOfXPlayers { get; set; }
public bool VoteBanned_TeamOnly { get; set; }
public float VoteBanned_Percentage { get; set; }
public bool VoteBanned_CenterMessageAnnouncementOnHalfVotes { get; set; }
public float VoteBanned_CenterMessageAnnouncementTimer { get; set; }
public bool VoteBanned_EvasionPunishment { get; set; }
public int VoteBanned_EvasionPunishmentTimeInDays { get; set; }
public string VoteBanned_CommandsToVote { get; set; }
public string VoteBanned_CommandsOnHalfVoteAccept { get; set; }
public string VoteBanned_CommandsOnHalfVoteRefuse { get; set; }
public string VoteBanned_ImmunityGroups { get; set; }
public string empty2 { get; set; }
public string Info_AboutAllAbove { get; set; }

public ConfigData()
{
VoteKick_Mode = 2;
VoteKick_TimeInMins = 5;
VoteKick_StartOnMinimumOfXPlayers = 5;
VoteKick_AllowKickedPlayersToJoinOnMapChange = false;
VoteKick_TeamOnly = false;
VoteKick_Percentage = 6;
Expand All @@ -133,6 +169,21 @@ public ConfigData()
VoteKick_CommandsOnHalfVoteAccept = "!yes,yes,!y,y";
VoteKick_CommandsOnHalfVoteRefuse = "!no,no,!n,n";
VoteKick_ImmunityGroups = "@css/root,@css/admin,@css/vip,#css/admin,#css/vip";
empty = "-----------------------------------------------------------------------------------";
VoteBanned_Mode = 0;
VoteBanned_TimeInDays = 1;
VoteBanned_StartOnMinimumOfXPlayers = 8;
VoteBanned_TeamOnly = false;
VoteBanned_Percentage = 8;
VoteBanned_CenterMessageAnnouncementOnHalfVotes = false;
VoteBanned_CenterMessageAnnouncementTimer = 25;
VoteBanned_EvasionPunishment = false;
VoteBanned_EvasionPunishmentTimeInDays = 2;
VoteBanned_CommandsToVote = "!votebanned,!banned,!vb";
VoteBanned_CommandsOnHalfVoteAccept = "!yes,yes,!y,y";
VoteBanned_CommandsOnHalfVoteRefuse = "!no,no,!n,n";
VoteBanned_ImmunityGroups = "@css/root,@css/admin,@css/vip,#css/admin,#css/vip";
empty2 = "-----------------------------------------------------------------------------------";
Info_AboutAllAbove = " For More Info Vist [https://github.com/oqyh/cs2-Vote-GoldKingZ/tree/main?tab=readme-ov-file#-configuration-]";
}
}
Expand Down
25 changes: 20 additions & 5 deletions Vote Banned/VoteBanned.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ private void HandleMenuCT(CCSPlayerController Caller, ChatMenuOption option, int
{
if(players == null || !players.IsValid)continue;
var steamid = players.SteamID;
if(Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))continue;
if (!Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid))
{
Globals_VoteBanned.VoteBanned_ShowMenuCT.Add(steamid, true);
Expand Down Expand Up @@ -493,8 +494,11 @@ private void HandleMenuCT(CCSPlayerController Caller, ChatMenuOption option, int
if (Configs.GetConfigData().VoteBanned_CenterMessageAnnouncementOnHalfVotes && Globals_VoteBanned.VoteBanned_GetVoted[TargetPlayerName] >= requiredct/2 && !string.IsNullOrEmpty(Localizer!["votebanned.announce.halfvotes.chat.message"]))
{
playersct.ForEach(player =>
Helper.AdvancedPrintToChat(player, Localizer["votebanned.announce.halfvotes.chat.message"])
);
{
var steamid = player.SteamID;
if (Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))return;
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"]);
});
}

if (Globals_VoteBanned.VoteBanned_GetVoted[TargetPlayerName] >= requiredct && !string.IsNullOrEmpty(Localizer!["votebanned.announce.banned.successfully.message"]))
Expand Down Expand Up @@ -580,6 +584,7 @@ private void HandleMenuT(CCSPlayerController Caller, ChatMenuOption option, int
{
if(players == null || !players.IsValid)continue;
var steamid = players.SteamID;
if(Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))continue;
if (!Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid))
{
Globals_VoteBanned.VoteBanned_ShowMenuT.Add(steamid, true);
Expand Down Expand Up @@ -609,8 +614,11 @@ private void HandleMenuT(CCSPlayerController Caller, ChatMenuOption option, int
if (Configs.GetConfigData().VoteBanned_CenterMessageAnnouncementOnHalfVotes && Globals_VoteBanned.VoteBanned_GetVoted[TargetPlayerName] >= requiredt/2 && !string.IsNullOrEmpty(Localizer!["votebanned.announce.halfvotes.chat.message"]))
{
playerst.ForEach(player =>
Helper.AdvancedPrintToChat(player, Localizer["votebanned.announce.halfvotes.chat.message"])
);
{
var steamid = player.SteamID;
if (Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))return;
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"]);
});
}

if (Globals_VoteBanned.VoteBanned_GetVoted[TargetPlayerName] >= requiredt && !string.IsNullOrEmpty(Localizer!["votebanned.announce.banned.successfully.message"]))
Expand Down Expand Up @@ -693,6 +701,7 @@ private void HandleMenuALL(CCSPlayerController Caller, ChatMenuOption option, in
{
if(players == null || !players.IsValid)continue;
var steamid = players.SteamID;
if(Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))continue;
if (!Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))
{
Globals_VoteBanned.VoteBanned_ShowMenuBOTH.Add(steamid, true);
Expand All @@ -716,7 +725,13 @@ private void HandleMenuALL(CCSPlayerController Caller, ChatMenuOption option, in

if (Configs.GetConfigData().VoteBanned_CenterMessageAnnouncementOnHalfVotes && Globals_VoteBanned.VoteBanned_GetVoted[TargetPlayerName] >= requiredall/2 && !string.IsNullOrEmpty(Localizer!["votebanned.announce.halfvotes.chat.message"]))
{
Helper.AdvancedPrintToServer(Localizer["votebanned.announce.halfvotes.chat.message"]);
var playersall = Helper.GetCounterTerroristController();
playersall.ForEach(player =>
{
var steamid = player.SteamID;
if (Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid) || Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))return;
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"]);
});
}

if (Globals_VoteBanned.VoteBanned_GetVoted[TargetPlayerName] >= requiredall && !string.IsNullOrEmpty(Localizer!["votebanned.announce.banned.successfully.message"]))
Expand Down
3 changes: 0 additions & 3 deletions Vote Banned/VoteBannedCenterAnnouncement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void OnTick()
{
if (Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(playerid) && Globals_VoteBanned.VoteBanned_ShowMenuCT[playerid] && player.TeamNum == (byte)CsTeam.CounterTerrorist)
{
if (Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(playerid) && Globals_VoteKick.VoteKick_ShowMenuCT[playerid])continue;
if (Globals_VoteBanned.VoteBanned_timerCT < 1 || Globals_VoteBanned.VoteBanned_countingCT >= Globals_VoteBanned.VoteBanned_requiredct)
{
Globals_VoteBanned.VoteBanned_timerCT = Configs.GetConfigData().VoteBanned_CenterMessageAnnouncementTimer;
Expand All @@ -51,7 +50,6 @@ public void OnTick()
}
if (Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(playerid) && Globals_VoteBanned.VoteBanned_ShowMenuT[playerid] && player.TeamNum == (byte)CsTeam.Terrorist)
{
if (Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(playerid) && Globals_VoteKick.VoteKick_ShowMenuT[playerid])continue;
if (Globals_VoteBanned.VoteBanned_timerT < 1 || Globals_VoteBanned.VoteBanned_countingT >= Globals_VoteBanned.VoteBanned_requiredt)
{
Globals_VoteBanned.VoteBanned_timerT = Configs.GetConfigData().VoteBanned_CenterMessageAnnouncementTimer;
Expand All @@ -77,7 +75,6 @@ public void OnTick()
{
if (Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(playerid) && Globals_VoteBanned.VoteBanned_ShowMenuBOTH[playerid])
{
if (Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(playerid) && Globals_VoteKick.VoteKick_ShowMenuBOTH[playerid])continue;
if (Globals_VoteBanned.VoteBanned_timerBOTH < 1 || Globals_VoteBanned.VoteBanned_countingBoth >= Globals_VoteBanned.VoteBanned_requiredboth)
{
Globals_VoteBanned.VoteBanned_timerBOTH = Configs.GetConfigData().VoteBanned_CenterMessageAnnouncementTimer;
Expand Down
25 changes: 20 additions & 5 deletions Vote Kick/VoteKick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ private void HandleMenuCT(CCSPlayerController Caller, ChatMenuOption option, int
{
if(players == null || !players.IsValid)continue;
var steamid = players.SteamID;
if(Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))continue;
if (!Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(steamid))
{
Globals_VoteKick.VoteKick_ShowMenuCT.Add(steamid, true);
Expand Down Expand Up @@ -494,8 +495,11 @@ private void HandleMenuCT(CCSPlayerController Caller, ChatMenuOption option, int
if (Configs.GetConfigData().VoteKick_CenterMessageAnnouncementOnHalfVotes && Globals_VoteKick.VoteKick_GetVoted[TargetPlayerName] >= requiredct/2 && !string.IsNullOrEmpty(Localizer!["votekick.announce.halfvotes.chat.message"]))
{
playersct.ForEach(player =>
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"])
);
{
var steamid = player.SteamID;
if (Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))return;
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"]);
});
}

if (Globals_VoteKick.VoteKick_GetVoted[TargetPlayerName] >= requiredct && !string.IsNullOrEmpty(Localizer!["votekick.announce.kick.successfully.message"]))
Expand Down Expand Up @@ -581,6 +585,7 @@ private void HandleMenuT(CCSPlayerController Caller, ChatMenuOption option, int
{
if(players == null || !players.IsValid)continue;
var steamid = players.SteamID;
if(Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))continue;
if (!Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(steamid))
{
Globals_VoteKick.VoteKick_ShowMenuT.Add(steamid, true);
Expand Down Expand Up @@ -610,8 +615,11 @@ private void HandleMenuT(CCSPlayerController Caller, ChatMenuOption option, int
if (Configs.GetConfigData().VoteKick_CenterMessageAnnouncementOnHalfVotes && Globals_VoteKick.VoteKick_GetVoted[TargetPlayerName] >= requiredt/2 && !string.IsNullOrEmpty(Localizer!["votekick.announce.halfvotes.chat.message"]))
{
playerst.ForEach(player =>
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"])
);
{
var steamid = player.SteamID;
if (Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))return;
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"]);
});
}

if (Globals_VoteKick.VoteKick_GetVoted[TargetPlayerName] >= requiredt && !string.IsNullOrEmpty(Localizer!["votekick.announce.kick.successfully.message"]))
Expand Down Expand Up @@ -694,6 +702,7 @@ private void HandleMenuALL(CCSPlayerController Caller, ChatMenuOption option, in
{
if(players == null || !players.IsValid)continue;
var steamid = players.SteamID;
if(Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))continue;
if (!Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(steamid))
{
Globals_VoteKick.VoteKick_ShowMenuBOTH.Add(steamid, true);
Expand All @@ -717,7 +726,13 @@ private void HandleMenuALL(CCSPlayerController Caller, ChatMenuOption option, in

if (Configs.GetConfigData().VoteKick_CenterMessageAnnouncementOnHalfVotes && Globals_VoteKick.VoteKick_GetVoted[TargetPlayerName] >= requiredall/2 && !string.IsNullOrEmpty(Localizer!["votekick.announce.halfvotes.chat.message"]))
{
Helper.AdvancedPrintToServer(Localizer["votekick.announce.halfvotes.chat.message"]);
var playerall = Helper.GetCounterTerroristController();
playerall.ForEach(player =>
{
var steamid = player.SteamID;
if (Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(steamid) || Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(steamid))return;
Helper.AdvancedPrintToChat(player, Localizer["votekick.announce.halfvotes.chat.message"]);
});
}

if (Globals_VoteKick.VoteKick_GetVoted[TargetPlayerName] >= requiredall && !string.IsNullOrEmpty(Localizer!["votekick.announce.kick.successfully.message"]))
Expand Down
3 changes: 0 additions & 3 deletions Vote Kick/VoteKickCenterAnnouncement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public void OnTick()
var playerid = player.SteamID;
if(Configs.GetConfigData().VoteKick_TeamOnly)
{
if (Globals_VoteBanned.VoteBanned_ShowMenuCT.ContainsKey(playerid) && Globals_VoteBanned.VoteBanned_ShowMenuCT[playerid])continue;
if (Globals_VoteKick.VoteKick_ShowMenuCT.ContainsKey(playerid) && Globals_VoteKick.VoteKick_ShowMenuCT[playerid] && player.TeamNum == (byte)CsTeam.CounterTerrorist)
{
if (Globals_VoteKick.VoteKick_timerCT < 1 || Globals_VoteKick.VoteKick_countingCT >= Globals_VoteKick.VoteKick_requiredct)
Expand All @@ -51,7 +50,6 @@ public void OnTick()
}
if (Globals_VoteKick.VoteKick_ShowMenuT.ContainsKey(playerid) && Globals_VoteKick.VoteKick_ShowMenuT[playerid] && player.TeamNum == (byte)CsTeam.Terrorist)
{
if (Globals_VoteBanned.VoteBanned_ShowMenuT.ContainsKey(playerid) && Globals_VoteBanned.VoteBanned_ShowMenuT[playerid])continue;
if (Globals_VoteKick.VoteKick_timerT < 1 || Globals_VoteKick.VoteKick_countingT >= Globals_VoteKick.VoteKick_requiredt)
{
Globals_VoteKick.VoteKick_timerT = Configs.GetConfigData().VoteKick_CenterMessageAnnouncementTimer;
Expand All @@ -77,7 +75,6 @@ public void OnTick()
{
if (Globals_VoteKick.VoteKick_ShowMenuBOTH.ContainsKey(playerid) && Globals_VoteKick.VoteKick_ShowMenuBOTH[playerid])
{
if (Globals_VoteBanned.VoteBanned_ShowMenuBOTH.ContainsKey(playerid) && Globals_VoteBanned.VoteBanned_ShowMenuBOTH[playerid])continue;
if (Globals_VoteKick.VoteKick_timerBOTH < 1 || Globals_VoteKick.VoteKick_countingBoth >= Globals_VoteKick.VoteKick_requiredboth)
{
Globals_VoteKick.VoteKick_timerBOTH = Configs.GetConfigData().VoteKick_CenterMessageAnnouncementTimer;
Expand Down
Loading

0 comments on commit 61e247d

Please sign in to comment.