mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-23 20:08:52 +00:00
1.3.3a
- Fixed godmode - Added logging commands to simpleadmin logs file - Fixed votes? - Added updating player_ip and player_name after connect with ban issued by css_addban
This commit is contained in:
@@ -8,7 +8,6 @@ using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text;
|
||||
|
||||
namespace CS2_SimpleAdmin
|
||||
@@ -47,6 +46,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.CommitSuicide(false, true);
|
||||
|
||||
Helper.LogCommand(caller, $"css_slay {player?.PlayerName}");
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -114,14 +115,18 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, CsItem weapon, string? callerName = null)
|
||||
{
|
||||
player.GiveNamedItem(weapon);
|
||||
SubGiveWeapon(caller, player, weapon.ToString(), callerName);
|
||||
Helper.LogCommand(caller, $"css_give {player?.PlayerName} {weapon.ToString()}");
|
||||
|
||||
player?.GiveNamedItem(weapon);
|
||||
SubGiveWeapon(caller, player!, weapon.ToString(), callerName);
|
||||
}
|
||||
|
||||
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||
{
|
||||
player.GiveNamedItem(weaponName);
|
||||
SubGiveWeapon(caller, player, weaponName, callerName);
|
||||
Helper.LogCommand(caller, $"css_give {player?.PlayerName} {weaponName}");
|
||||
|
||||
player?.GiveNamedItem(weaponName);
|
||||
SubGiveWeapon(caller, player!, weaponName, callerName);
|
||||
}
|
||||
|
||||
public void SubGiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||
@@ -177,6 +182,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.RemoveWeapons();
|
||||
|
||||
Helper.LogCommand(caller, $"css_strip {player?.PlayerName}");
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -229,6 +236,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetHp(health);
|
||||
|
||||
Helper.LogCommand(caller, $"css_hp {player?.PlayerName} {health}");
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -281,6 +290,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetSpeed((float)speed);
|
||||
|
||||
Helper.LogCommand(caller, $"css_speed {player?.PlayerName} {speed}");
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -288,7 +299,7 @@ namespace CS2_SimpleAdmin
|
||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||
{
|
||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||
sb.Append(_localizer["sa_admin_speed_message", callerName, player.PlayerName]);
|
||||
sb.Append(_localizer["sa_admin_speed_message", callerName, player!.PlayerName]);
|
||||
_player.PrintToChat(sb.ToString());
|
||||
}
|
||||
}
|
||||
@@ -330,13 +341,15 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
Helper.LogCommand(caller, $"css_god {player.PlayerName}");
|
||||
|
||||
if (!godPlayers.Contains(player.Slot))
|
||||
{
|
||||
godPlayers.Add(player.Slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
godPlayers = new ConcurrentBag<int>(godPlayers.Where(item => item != player.Slot));
|
||||
RemoveFromConcurrentBag(godPlayers, player.Slot);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
@@ -395,6 +408,8 @@ namespace CS2_SimpleAdmin
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
player!.Pawn.Value!.Slap(damage);
|
||||
|
||||
Helper.LogCommand(caller, $"css_slap {player?.PlayerName} {damage}");
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -456,9 +471,12 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
|
||||
bool kill = command.GetArg(3).ToLower().Equals("-k");
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
ChangeTeam(caller, player, _teamName.ToLower(), teamNum, kill, callerName);
|
||||
ChangeTeam(caller, player, _teamName, teamNum, kill, callerName);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -527,6 +545,8 @@ namespace CS2_SimpleAdmin
|
||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
||||
}
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||
@@ -591,6 +611,8 @@ namespace CS2_SimpleAdmin
|
||||
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
||||
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
||||
|
||||
Helper.LogCommand(caller, $"css_respawn {player.PlayerName}");
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -629,6 +651,8 @@ namespace CS2_SimpleAdmin
|
||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
||||
}
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17 || !player.PawnIsAlive)
|
||||
@@ -683,6 +707,8 @@ namespace CS2_SimpleAdmin
|
||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
||||
}
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17 || !player.PawnIsAlive)
|
||||
|
||||
Reference in New Issue
Block a user