58 lines
1.6 KiB
SourcePawn
58 lines
1.6 KiB
SourcePawn
#include <sourcemod>
|
|
#include <sdktools>
|
|
|
|
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 OnPluginStart() {
|
|
RegAdminCmd("sm_quick_noclip", Command_QuickNoclip, ADMFLAG_SLAY|ADMFLAG_CHEATS);
|
|
RegAdminCmd("sm_god", Command_Godmode, 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;
|
|
} |