fix noclip and add godmode

This commit is contained in:
Nomi Nonsense (Nonszy) 2025-08-11 22:37:17 +07:00
parent 73e6c4c81b
commit 8bc6e3b9a3

View File

@ -5,18 +5,21 @@ public Plugin myinfo = {
name = "AdminGod", name = "AdminGod",
author = "Nonszy", author = "Nonszy",
description = "Admin-only ttols", description = "Admin-only ttols",
version = "1.0", version = "1.0.1",
url = "https://gitea.nonszy.space/nomi-nonsz/left4dead2-admingod" url = "https://gitea.nonszy.space/nomi-nonsz/left4dead2-admingod"
}; };
bool g_bGodmode[MAXPLAYERS + 1];
public void OnPluginStart() { 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 (!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."); PrintToChat(client, "[SM] You do not have permission to use noclip.");
return Plugin_Handled; return Plugin_Handled;
} }
@ -33,3 +36,23 @@ public Action Cmd_Slot10(int client, int args) {
return Plugin_Handled; 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;
}