From 317cefeb950b74829894596419a831db3b1cc5ab Mon Sep 17 00:00:00 2001 From: nomi-nonsz Date: Mon, 11 Aug 2025 22:41:13 +0700 Subject: [PATCH] add give command --- scripting/admingod.sp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripting/admingod.sp b/scripting/admingod.sp index 9efdf86..8011c58 100644 --- a/scripting/admingod.sp +++ b/scripting/admingod.sp @@ -14,6 +14,7 @@ bool g_bGodmode[MAXPLAYERS + 1]; public void OnPluginStart() { RegAdminCmd("sm_quick_noclip", Command_QuickNoclip, ADMFLAG_SLAY|ADMFLAG_CHEATS); RegAdminCmd("sm_god", Command_Godmode, ADMFLAG_SLAY|ADMFLAG_CHEATS); + RegAdminCmd("sm_give", Command_Give, ADMFLAG_SLAY|ADMFLAG_CHEATS); } public Action Command_QuickNoclip(int client, int args) { @@ -54,5 +55,30 @@ public Action Command_Godmode(int client, int args) PrintToChat(client, "[Godmode] (godmode OFF)"); } + return Plugin_Handled; +} + +public Action Command_Give(int client, int args) +{ + if (!IsClientInGame(client) || !IsPlayerAlive(client)) return Plugin_Handled; + + if (args < 1) + { + ReplyToCommand(client, "[SM] Usage: sm_give "); + return Plugin_Handled; + } + + char arg[64]; + GetCmdArg(1, arg, sizeof(arg)); + + char cmd[64]; + StrCat(cmd, sizeof(cmd), "give "); + StrCat(cmd, sizeof(cmd), arg); + + int flagsgive = GetCommandFlags("give"); + SetCommandFlags("give", flagsgive & ~FCVAR_CHEAT); + FakeClientCommand(client, "give"); + SetCommandFlags("give", flagsgive|FCVAR_CHEAT); + return Plugin_Handled; } \ No newline at end of file