1
0

update kick vote

This commit is contained in:
GenZmeY 2022-08-13 14:13:47 +03:00
parent 51aba2c1a1
commit 5faba66cb1
6 changed files with 16 additions and 40 deletions

View File

@ -224,15 +224,10 @@ private function bool PlayerHasRequiredLevel(KFPlayerController KFPC)
return (KFPRI.GetActivePerkLevel() >= CfgStartWaveKickProtection.default.MinLevel);
}
public function bool PlayerCanKickVote(KFPlayerController KFPC, optional KFPlayerController KFPC_Kickee)
public function bool PlayerCanStartKickVote(KFPlayerController KFPC, KFPlayerController KFPC_Kickee)
{
`Log_Trace();
if (KFPC_Kickee == None)
{
KFPC_Kickee = KFPlayerController(KFGRI.VoteCollector.CurrentKickVote.PlayerPRI.Owner);
}
if (KFPC_Kickee != None)
{
if (KFPC == KFPC_Kickee)

View File

@ -7,8 +7,8 @@ var private localized String PlayerIsKickProtected;
var const String PlayerIsStartWaveKickProtectedDefault;
var private localized String PlayerIsStartWaveKickProtected;
var const String PlayerCantVoteDefault;
var private localized String PlayerCantVote;
var const String PlayerCantStartKickVoteDefault;
var private localized String PlayerCantStartKickVote;
var const String KickVoteNotEnoughPlayersDefault;
var private localized String KickVoteNotEnoughPlayers;
@ -44,7 +44,7 @@ enum E_CVC_LocalMessageType
{
CVC_PlayerIsKickProtected,
CVC_PlayerIsStartWaveKickProtected,
CVC_PlayerCantVote,
CVC_PlayerCantStartKickVote,
CVC_KickVoteNotEnoughPlayers,
CVC_KickVoteStarted,
@ -97,8 +97,8 @@ public static function String GetLocalizedString(
case CVC_PlayerIsStartWaveKickProtected:
return ReplWaves(ReplKickee(default.PlayerIsStartWaveKickProtected != "" ? default.PlayerIsStartWaveKickProtected : default.PlayerIsStartWaveKickProtectedDefault, String1), String2);
case CVC_PlayerCantVote:
return ReplWaves(default.PlayerCantVote != "" ? default.PlayerCantVote : default.PlayerCantVoteDefault, String1);
case CVC_PlayerCantStartKickVote:
return ReplWaves(default.PlayerCantStartKickVote != "" ? default.PlayerCantStartKickVote : default.PlayerCantStartKickVoteDefault, String1);
case CVC_KickVoteNotEnoughPlayers:
return ReplWaves(default.KickVoteNotEnoughPlayers != "" ? default.KickVoteNotEnoughPlayers : default.KickVoteNotEnoughPlayersDefault, String1);
@ -147,7 +147,7 @@ defaultproperties
{
PlayerIsKickProtectedDefault = "<kickee> is protected from kick"
PlayerIsStartWaveKickProtectedDefault = "You can't kick <kickee> right now. He can be kicked when he plays at least <waves> wave(s)"
PlayerCantVoteDefault = "You can't vote for kick now. You can vote when you play at least <waves> wave(s)"
PlayerCantStartKickVoteDefault = "You can't start kick vote now. You can start kick vote when you play at least <waves> wave(s)"
KickVoteNotEnoughPlayersDefault = "Not enough players to start vote (only players who have played at least <waves> wave(s) can vote)"
KickVoteStartedDefault = "<kicker> has started a vote to kick <kickee>"
KickVoteStartedForPlayerDefault = "<kicker> started voting to kick you"

View File

@ -46,7 +46,6 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
{
local Array<KFPlayerReplicationInfo> KFPRIs;
local KFPlayerReplicationInfo KFPRI;
local KFPlayerController KFPC;
local KFGameInfo KFGI;
`Log_Trace();
@ -70,11 +69,11 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
return;
}
if (!CVC.PlayerCanKickVote(KFPC_Kicker, KFPC_Kickee))
if (!CVC.PlayerCanStartKickVote(KFPC_Kicker, KFPC_Kickee))
{
CVC.WriteToChatLocalized(
KFPC_Kicker,
CVC_PlayerCantVote,
CVC_PlayerCantStartKickVote,
CfgKickVote.default.WarningColorHex,
String(CfgStartWaveKickProtection.default.Waves));
return;
@ -164,7 +163,7 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
GetKFPRIArray(KFPRIs);
foreach KFPRIs(KFPRI)
{
KFPRI.ShowKickVote(PRI_Kickee, VoteTime, !(KFPRI == PRI_Kicker || KFPRI == PRI_Kickee || !CVC.PlayerCanKickVote(KFPlayerController(KFPRI.Owner))));
KFPRI.ShowKickVote(PRI_Kickee, VoteTime, !(KFPRI == PRI_Kicker || KFPRI == PRI_Kickee));
}
if (CfgKickVote.default.bChatNotifications)
@ -180,25 +179,7 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
KFPC_Kickee,
CVC_KickVoteStartedForPlayer,
CfgKickVote.default.NegativeColorHex,
KickerName,
KickeeName);
foreach KFPRIs(KFPRI)
{
if (KFPRI == PRI_Kickee)
{
continue;
}
KFPC = KFPlayerController(KFPRI.Owner);
if (!CVC.PlayerCanKickVote(KFPC))
{
CVC.WriteToChatLocalized(
KFPC,
CVC_PlayerCantVote,
CfgKickVote.default.WarningColorHex,
String(CfgStartWaveKickProtection.default.Waves));
}
}
KickerName);
}
else
{
@ -260,7 +241,7 @@ private function int VotingPlayers(optional PlayerReplicationInfo KickeePRI, opt
foreach KFPRIs(KFPRI)
{
KFPC = KFPlayerController(KFPRI.Owner);
if (KFPC != None && CVC.PlayerCanKickVote(KFPC, KFPC_Kickee))
if (KFPC != None && KFPC != KFPC_Kickee)
{
VotingPlayersNum++;
}
@ -569,7 +550,7 @@ private function LogKickVotes()
}
`Log_Kick("Kicker:" @ LogVotePlayer(Kicker));
`Log_Kick("Kicked:" @ LogVotePlayer(Kickee) @ String(Kickee.Perk) @ String(Kickee.Level));
`Log_Kick("Kicked:" @ LogVotePlayer(Kickee));
`Log_Kick("Yes voters:");
foreach Yes(KV) `Log_Kick(LogVotePlayer(KV));
@ -584,7 +565,7 @@ private function String LogVotePlayer(S_KickVote KV)
{
`Log_Trace();
return KV.Name @ "(UniqueID:" @ KV.UniqueID $ (KV.SteamID == "" ? "" : (", SteamID:" @ KV.SteamID $ ", Profile:" @ "https://steamcommunity.com/profiles/" $ KV.SteamID)) $ ")";
return KV.Name @ "(UniqueID:" @ KV.UniqueID $ (KV.SteamID == "" ? "" : (", SteamID:" @ KV.SteamID $ ", Profile:" @ "https://steamcommunity.com/profiles/" $ KV.SteamID)) $ ")" @ "Perk:" @ Repl(String(KV.Perk), "KFPerk_", "", false) @ "Level:" @ String(KV.Level);
}
public reliable server function RecieveVoteSkipTrader(PlayerReplicationInfo PRI, bool bSkip)

Binary file not shown.

Binary file not shown.

View File

@ -111,9 +111,9 @@ In this section, the system for preventing early kicks is configured (especially
[b]How start wave kick protection works:[/b]
When a player joins a server, he is protected from a kick for the specified number of [b]Waves[/b]. This keeps the server from being taken over by players, and it also forces current players to play with the new player for at least a little bit before they can kick him. This solves most of the unfair kicks in the game.
Along with receiving the kick protection, the new player loses the ability to vote for the kick. This eliminates the ability for new players to remove existing players using kick protection for impunity.
Along with receiving the kick protection, the new player loses the ability to start kick vote. This eliminates the ability for new players to remove existing players using kick protection for impunity.
When the player has played the specified number of [b]Waves[/b], he loses the kick protection and gets the opportunity to vote for the kick.
When the player has played the specified number of [b]Waves[/b], he loses the kick protection and gets the opportunity to start kick vote.
The [b]MinLevel[/b] parameter specifies an exception to these rules, giving kick protection only to players above or equal the specified level. All players can vote to exclude players with an unsuitable level, regardless of whether they have played enough [b]Waves[/b] or not. This allows to remove low-level players without waiting for them to screw up in the game.