diff --git a/CS2-SimpleAdmin.cs b/CS2-SimpleAdmin.cs index 53b47b5..e442a10 100644 --- a/CS2-SimpleAdmin.cs +++ b/CS2-SimpleAdmin.cs @@ -916,7 +916,19 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig ", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] + public void OnGiveCommand(CCSPlayerController? caller, CommandInfo command) + { + if(!GetTarget(command, out var player) || player == null || !player.IsValid) return; + + string weapon = command.GetArg(2); + player.GiveNamedItem(weapon); + + Server.PrintToChatAll(Helper.ReplaceTags($" {Config.Prefix} {Config.Messages.AdminChangeMap}".Replace("{ADMIN}", caller?.PlayerName == null ? "Console" : caller.PlayerName).Replace("{WEAPON}", weapon))); + } private static bool GetTarget(CommandInfo command, out CCSPlayerController? player) { diff --git a/Config.cs b/Config.cs index d9210b3..cd76a34 100644 --- a/Config.cs +++ b/Config.cs @@ -41,6 +41,8 @@ namespace CS2_SimpleAdmin public string AdminRespawnMessage { get; set; } = "Admin {ADMIN} respawned {PLAYER}!"; [JsonPropertyName("AdminSayPrefix")] public string AdminSayPrefix { get; set; } = "{RED}ADMIN: {DEFAULT}"; + [JsonPropertyName("AdminGiveMessage")] + public string AdminGiveMessage { get; set; } = "Admin {ADMIN} Gave {PLAYER} a {WEAPON}!"; [JsonPropertyName("AdminHelpCommand")] public string AdminHelpCommand { get; set; } = "{GREEN}[ CS2-SimpleAdmin HELP ]{DEFAULT}\n- css_ban <#userid or name> [time in minutes/0 perm] [reason] - Ban player\n- css_addban [time in minutes/0 perm] [reason] - Ban player via steamid64\n" + "- css_banip [time in minutes/0 perm] [reason] - Ban player via IP address\n- css_unban - Unban player\n" + diff --git a/README.md b/README.md index 083d7d1..f5e5c8a 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ It's only plugin base, I don't have much time for more extensive development, so - css_respawn <#userid or name> - Respawn player // @css/cheats - css_cvar - Change cvar value // @css/cvar - css_rcon - Run command as server // @css/rcon +- css_give <#userid or name> - Gives a weapon to a Player // @css/cheats - @Message - Say message to all admins // @css/chat ```