142 lines
3.0 KiB
SourcePawn
142 lines
3.0 KiB
SourcePawn
/* Plugin Template generated by Pawn Studio */
|
|
|
|
#include <sourcemod>
|
|
|
|
public Plugin:myinfo =
|
|
{
|
|
name = "Unset Cheats",
|
|
author = "Chefe",
|
|
description = "<- Description ->",
|
|
version = "1.0",
|
|
url = "<- URL ->"
|
|
}
|
|
|
|
public OnPluginStart()
|
|
{
|
|
RegAdminCmd("sm_unsetcheat", Command_UnSetCheat, ADMFLAG_KICK, "Unset a Cheatflag from an ConVar.");
|
|
RegAdminCmd("sm_setcheat", Command_SetCheat, ADMFLAG_KICK, "Set a Cheatflag from an ConVar.");
|
|
RegAdminCmd("sm_unsetcheatcmd", Command_UnSetCheatCmd, ADMFLAG_KICK, "Unset a Cheatflag from an ConVar.");
|
|
RegAdminCmd("sm_setcheatcmd", Command_SetCheat, ADMFLAG_KICK, "Set a Cheatflag from an ConVar.");
|
|
RegAdminCmd("sm_fakecmd", Command_FakeClientCmd, ADMFLAG_CHEATS, "Fake a CMD of an given Client.")
|
|
}
|
|
|
|
public Action:Command_FakeClientCmd(client_at, args)
|
|
{
|
|
if (args < 1)
|
|
{
|
|
ReplyToCommand(client_at, "Usage: sm_fakecmd <userid> <cmd>");
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
new String:cmd[256], String:arg1[256];
|
|
|
|
GetCmdArg(1, arg1, sizeof(arg1));
|
|
GetCmdArg(2, cmd, sizeof(cmd));
|
|
|
|
new userid = StringToInt(arg1);
|
|
new client = GetClientOfUserId(userid);
|
|
|
|
if (IsClientInGame(client))
|
|
{
|
|
FakeClientCommand(client, cmd);
|
|
}
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
public Action:Command_UnSetCheat(client, args)
|
|
{
|
|
if (args < 1)
|
|
{
|
|
PrintToConsole(client, "Usage: sm_unsetcheat <convarname>");
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
new String:convar[256];
|
|
GetCmdArg(1, convar, sizeof(convar));
|
|
new Handle:convar_handle = FindConVar(convar);
|
|
|
|
if (convar_handle != INVALID_HANDLE)
|
|
{
|
|
UnsetCheatVar(convar_handle);
|
|
}
|
|
else
|
|
{
|
|
ReplyToCommand(client, "[SM] Unable to find ConVar %s", convar)
|
|
}
|
|
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
public Action:Command_UnSetCheatCmd(client, args)
|
|
{
|
|
if (args < 1)
|
|
{
|
|
PrintToConsole(client, "Usage: sm_unsetcheatcmd <convarname>");
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
new String:cmd[256];
|
|
GetCmdArg(1, cmd, sizeof(cmd));
|
|
|
|
new flags = GetCommandFlags(cmd);
|
|
flags &= ~FCVAR_CHEAT;
|
|
SetCommandFlags(cmd, flags);
|
|
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
public Action:Command_SetCheat(client, args)
|
|
{
|
|
if (args < 1)
|
|
{
|
|
PrintToConsole(client, "Usage: sm_setcheat <convarname>");
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
new String:convar[256];
|
|
GetCmdArg(1, convar, sizeof(convar));
|
|
new Handle:convar_handle = FindConVar(convar);
|
|
|
|
if (convar_handle != INVALID_HANDLE)
|
|
{
|
|
SetCheatVar(convar_handle);
|
|
}
|
|
else
|
|
{
|
|
ReplyToCommand(client, "[SM] Unable to find ConVar %s", convar)
|
|
}
|
|
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
public Action:Command_SetCheatCmd(client, args)
|
|
{
|
|
if (args < 1)
|
|
{
|
|
PrintToConsole(client, "Usage: sm_setcheatcmd <convarname>");
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
new String:cmd[256];
|
|
GetCmdArg(1, cmd, sizeof(cmd));
|
|
|
|
new flags = GetCommandFlags(cmd);
|
|
flags |= FCVAR_CHEAT;
|
|
SetCommandFlags(cmd, flags);
|
|
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
UnsetCheatVar(Handle:hndl)
|
|
{
|
|
new flags = GetConVarFlags(hndl);
|
|
flags &= ~FCVAR_CHEAT;
|
|
SetConVarFlags(hndl, flags);
|
|
}
|
|
|
|
SetCheatVar(Handle:hndl)
|
|
{
|
|
new flags = GetConVarFlags(hndl);
|
|
flags |= FCVAR_CHEAT;
|
|
SetConVarFlags(hndl, flags);
|
|
} |