View Single Post
Bobakanoosh
Senior Member
Join Date: Sep 2015
Location: United States
Old 05-22-2017 , 23:24   Re: Admin Flag N (Cheats Flag) Issue
Reply With Quote #3

You could make a command that runs sv_cheats as the server:

Code:
bool g_bEnabled;

public OnPluginStart() {

	RegAdminCmd("sm_enablecheats", Command_EnableCheats, ADMFLAG_CHANGEMAP, "Sets sv_cheats to 1"); 
	
}

public Action Command_EnableCheats(int client, int args) {

	if(MaxClients < client < 2)
		return Plugin_Handled;

	if(g_bEnabled) {
	
		ServerCommand("sv_cheats 0");
		PrintToChat(client, "You've disabled sv_cheats.");
                g_bEnabled = false;
	
	} else {
	
		ServerCommand("sv_cheats 1");
		PrintToChat(client, "You've enabled sv_cheats.");
                g_bEnabled = true;
	
	}
		
	return Plugin_Handled;

}
Just change the ADMFLAG_ to any of these: https://sm.alliedmods.net/new-api/admin/AdminFlag depending on who you want to have access.

https://sm.alliedmods.net/new-api/console/ServerCommand

Last edited by Bobakanoosh; 05-22-2017 at 23:26. Reason: Didn't change g_bEnabled
Bobakanoosh is offline