diff --git a/scripting/admingod.sp b/scripting/admingod.sp index 99e78a6..9efdf86 100644 --- a/scripting/admingod.sp +++ b/scripting/admingod.sp @@ -5,18 +5,21 @@ public Plugin myinfo = { name = "AdminGod", author = "Nonszy", description = "Admin-only ttols", - version = "1.0", + version = "1.0.1", url = "https://gitea.nonszy.space/nomi-nonsz/left4dead2-admingod" }; +bool g_bGodmode[MAXPLAYERS + 1]; + public void OnPluginStart() { - RegConsoleCmd("slot10", Cmd_Slot10); + RegAdminCmd("sm_quick_noclip", Command_QuickNoclip, ADMFLAG_SLAY|ADMFLAG_CHEATS); + RegAdminCmd("sm_god", Command_Godmode, ADMFLAG_SLAY|ADMFLAG_CHEATS); } -public Action Cmd_Slot10(int client, int args) { +public Action Command_QuickNoclip(int client, int args) { if (!IsClientInGame(client) || !IsPlayerAlive(client)) return Plugin_Handled; - if (!CheckCommandAccess(client, "noclip_admin", ADMFLAG_GENERIC)) { + if (!CheckCommandAccess(client, "sm_noclip", ADMFLAG_CHEATS)) { PrintToChat(client, "[SM] You do not have permission to use noclip."); return Plugin_Handled; } @@ -33,3 +36,23 @@ public Action Cmd_Slot10(int client, int args) { return Plugin_Handled; } + +public Action Command_Godmode(int client, int args) +{ + if (!IsClientInGame(client) || !IsPlayerAlive(client)) return Plugin_Handled; + + g_bGodmode[client] = !g_bGodmode[client]; + + if (g_bGodmode[client]) + { + SetEntProp(client, Prop_Data, "m_takedamage", 0); + PrintToChat(client, "[Godmode] (godmode ON)"); + } + else + { + SetEntProp(client, Prop_Data, "m_takedamage", 2); + PrintToChat(client, "[Godmode] (godmode OFF)"); + } + + return Plugin_Handled; +} \ No newline at end of file