Beispiel #1
0
        private void KickPlayer([FromSource] Player source, int target, string kickReason = "You have been kicked from the server.")
        {
            if (IsPlayerAceAllowed(source.Handle, "vChar.OnlinePlayers.Kick") || IsPlayerAceAllowed(source.Handle, "vChar.Everything") ||
                IsPlayerAceAllowed(source.Handle, "vChar.OnlinePlayers.All"))
            {
                // If the player is allowed to be kicked.
                Player targetPlayer = Players[target];
                if (targetPlayer != null)
                {
                    if (!IsPlayerAceAllowed(targetPlayer.Handle, "vChar.DontKickMe"))
                    {
                        TriggerEvent("vChar:KickSuccessful", source.Name, kickReason, targetPlayer.Name);

                        KickLog($"Player: {source.Name} has kicked: {targetPlayer.Name} for: {kickReason}.");
                        TriggerClientEvent(player: source, eventName: "vChar:Notify", args: $"The target player (<C>{targetPlayer.Name}</C>) has been kicked.");

                        // Kick the player from the server using the specified reason.
                        DropPlayer(targetPlayer.Handle, kickReason);
                        return;
                    }
                    // Trigger the client event on the source player to let them know that kicking this player is not allowed.
                    TriggerClientEvent(player: source, eventName: "vChar:Notify", args: "Sorry, this player can ~r~not ~w~be kicked.");
                    return;
                }
                TriggerClientEvent(player: source, eventName: "vChar:Notify", args: "An unknown error occurred. Report it here: vespura.com/vmenu");
            }
            else
            {
                BanManager.BanCheater(source);
            }
        }
Beispiel #2
0
 private void SummonPlayer([FromSource] Player source, int target)
 {
     if (IsPlayerAceAllowed(source.Handle, "vChar.OnlinePlayers.Summon") || IsPlayerAceAllowed(source.Handle, "vChar.Everything") ||
         IsPlayerAceAllowed(source.Handle, "vChar.OnlinePlayers.All"))
     {
         // Trigger the client event on the target player to make them teleport to the source player.
         Player targetPlayer = Players[target];
         if (targetPlayer != null)
         {
             TriggerClientEvent(player: targetPlayer, eventName: "vChar:GoToPlayer", args: source.Handle);
             return;
         }
         TriggerClientEvent(player: source, eventName: "vChar:Notify", args: "An unknown error occurred. Report it here: vespura.com/vmenu");
     }
     else
     {
         BanManager.BanCheater(source);
     }
 }
Beispiel #3
0
 private void KillPlayer([FromSource] Player source, int target)
 {
     if (IsPlayerAceAllowed(source.Handle, "vChar.OnlinePlayers.Kill") || IsPlayerAceAllowed(source.Handle, "vChar.Everything") ||
         IsPlayerAceAllowed(source.Handle, "vChar.OnlinePlayers.All"))
     {
         Player targetPlayer = Players[target];
         if (targetPlayer != null)
         {
             // Trigger the client event on the target player to make them kill themselves. R.I.P.
             TriggerClientEvent(player: targetPlayer, eventName: "vChar:KillMe", args: source.Name);
             return;
         }
         TriggerClientEvent(player: source, eventName: "vChar:Notify", args: "An unknown error occurred. Report it here: vespura.com/vmenu");
     }
     else
     {
         BanManager.BanCheater(source);
     }
 }