1
0

fix the ability to kick players who are not loaded

This commit is contained in:
GenZmeY 2023-06-29 01:39:54 +03:00
parent 158c6b8a2e
commit 690aa2ba6f
5 changed files with 25 additions and 0 deletions

View File

@ -183,6 +183,13 @@ public function bool PlayerIsKickProtected(PlayerReplicationInfo PRI)
return (KickProtectedPlayers.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE); return (KickProtectedPlayers.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE);
} }
public function bool PlayerPerkLoaded(PlayerReplicationInfo PRI)
{
`Log_Trace();
return (KFPlayerReplicationInfo(PRI) != None && KFPlayerReplicationInfo(PRI).CurrentPerkClass != None);
}
public function bool PlayerIsStartWaveKickProtected(KFPlayerController KFPC) public function bool PlayerIsStartWaveKickProtected(KFPlayerController KFPC)
{ {
`Log_Trace(); `Log_Trace();

View File

@ -10,6 +10,9 @@ var private localized String PlayerIsStartWaveKickProtected;
var const String PlayerCantStartKickVoteDefault; var const String PlayerCantStartKickVoteDefault;
var private localized String PlayerCantStartKickVote; var private localized String PlayerCantStartKickVote;
var const String PlayerPerkIsNotLoadedDefault;
var private localized String PlayerPerkIsNotLoaded;
var const String KickVoteNotEnoughPlayersDefault; var const String KickVoteNotEnoughPlayersDefault;
var private localized String KickVoteNotEnoughPlayers; var private localized String KickVoteNotEnoughPlayers;
@ -33,6 +36,7 @@ enum E_CVC_LocalMessageType
CVC_PlayerIsKickProtected, CVC_PlayerIsKickProtected,
CVC_PlayerIsStartWaveKickProtected, CVC_PlayerIsStartWaveKickProtected,
CVC_PlayerCantStartKickVote, CVC_PlayerCantStartKickVote,
CVC_PlayerPerkIsNotLoaded,
CVC_KickVoteNotEnoughPlayers, CVC_KickVoteNotEnoughPlayers,
CVC_KickVoteStarted, CVC_KickVoteStarted,
@ -88,6 +92,9 @@ public static function String GetLocalizedString(
case CVC_PlayerCantStartKickVote: case CVC_PlayerCantStartKickVote:
return ReplWaves(default.PlayerCantStartKickVote != "" ? default.PlayerCantStartKickVote : default.PlayerCantStartKickVoteDefault, String1); return ReplWaves(default.PlayerCantStartKickVote != "" ? default.PlayerCantStartKickVote : default.PlayerCantStartKickVoteDefault, String1);
case CVC_PlayerPerkIsNotLoaded:
return ReplKickee(default.PlayerPerkIsNotLoaded != "" ? default.PlayerPerkIsNotLoaded : default.PlayerPerkIsNotLoadedDefault, String1);
case CVC_KickVoteNotEnoughPlayers: case CVC_KickVoteNotEnoughPlayers:
return ReplWaves(default.KickVoteNotEnoughPlayers != "" ? default.KickVoteNotEnoughPlayers : default.KickVoteNotEnoughPlayersDefault, String1); return ReplWaves(default.KickVoteNotEnoughPlayers != "" ? default.KickVoteNotEnoughPlayers : default.KickVoteNotEnoughPlayersDefault, String1);
@ -136,6 +143,7 @@ defaultproperties
PlayerIsKickProtectedDefault = "<kickee> is protected from kick" 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)" PlayerIsStartWaveKickProtectedDefault = "You can't kick <kickee> right now. He can be kicked when he plays 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)" PlayerCantStartKickVoteDefault = "You can't start kick vote now. You can start kick vote when you play at least <waves> wave(s)"
PlayerPerkIsNotLoadedDefault = "You can't kick a player who hasn't loaded yet (<kickee>)"
KickVoteNotEnoughPlayersDefault = "Not enough players to start vote (only players who have played at least <waves> wave(s) can vote)" 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>" KickVoteStartedDefault = "<kicker> has started a vote to kick <kickee>"
KickVoteStartedForPlayerDefault = "<kicker> started voting to kick you" KickVoteStartedForPlayerDefault = "<kicker> started voting to kick you"

View File

@ -92,6 +92,16 @@ public function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerRepl
return; return;
} }
if (!CVC.PlayerPerkLoaded(PRI_Kickee))
{
CVC.WriteToChatLocalized(
KFPC_Kicker,
CVC_PlayerPerkIsNotLoaded,
CfgKickVote.default.WarningColorHex,
KickeeName);
return;
}
if (CVC.PlayerIsStartWaveKickProtected(KFPC_Kickee)) if (CVC.PlayerIsStartWaveKickProtected(KFPC_Kickee))
{ {
CVC.WriteToChatLocalized( CVC.WriteToChatLocalized(

Binary file not shown.

Binary file not shown.