#include #include public Plugin myinfo = { name = "AdminGod", author = "Nonszy", description = "Admin-only ttols", version = "1.0.1", url = "https://gitea.nonszy.space/nomi-nonsz/left4dead2-admingod" }; bool g_bGodmode[MAXPLAYERS + 1]; public void OnClientPutInServer(int client) { if (!IsClientInGame(client) || IsFakeClient(client)) return; char name[64]; char steamID[64]; GetClientName(client, name, sizeof(name)); GetClientAuthId(client, AuthId_Steam2, steamID, sizeof(steamID)); PrintToServer("[ClientLogger] %s (%s) connected", name, steamID); LogAction(client, -1, "%s (%s) has connected to the server", name, steamID); } 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) { if (!IsClientInGame(client) || !IsPlayerAlive(client)) return Plugin_Handled; if (!CheckCommandAccess(client, "sm_noclip", ADMFLAG_CHEATS)) { PrintToChat(client, "[SM] You do not have permission to use noclip."); return Plugin_Handled; } MoveType flags = GetEntityMoveType(client); if (flags == MOVETYPE_NOCLIP) { SetEntityMoveType(client, MOVETYPE_WALK); PrintToChat(client, "[SM] Noclip OFF."); } else { SetEntityMoveType(client, MOVETYPE_NOCLIP); PrintToChat(client, "[SM] Noclip ON."); } 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; } 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; }