Raised This Month: $12 Target: $400
 3% 

sv_cheats ONLY FOR HOST / ADMIN


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellnecrotom
Junior Member
Join Date: Feb 2021
Old 06-22-2022 , 03:56   sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #1

Hey guys, my server relies on a lot of cheats to function and I have to let "sv_cheats 1" be on to moderate it without headaches.

However, clients constantly abuse cheats due to this. Question: Is there a way or a plugin here that enables cheats ONLY FOR HOST / ADMIN?

I tried looking everywhere for this but can't find anything.

Thanks

-------------------------

PS: I know I posted in the wrong section - it was accidental. Can't remove it - tried.

Last edited by hellnecrotom; 06-22-2022 at 04:00. Reason: Accidentally posted in wrong section. Want to delete thread
hellnecrotom is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 06-22-2022 , 04:32   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #2

Quote:
Originally Posted by hellnecrotom View Post
Hey guys, my server relies on a lot of cheats to function and I have to let "sv_cheats 1" be on to moderate it without headaches.

However, clients constantly abuse cheats due to this. Question: Is there a way or a plugin here that enables cheats ONLY FOR HOST / ADMIN?

I tried looking everywhere for this but can't find anything.

Thanks

-------------------------

PS: I know I posted in the wrong section - it was accidental. Can't remove it - tried.
untested:

Code:
#include <sourcemod>

Handle sv_cheats = null;

public void OnPluginStart()
{
	sv_cheats = FindConVar("sv_cheats");
	
	HookEvent("player_spawn", Event_Player_Spawn, EventHookMode_Post);
	for(int i = 1; i <= MaxClients; i++)
	{
		if(IsClientInGame(i) && !IsFakeClient(i) && GetUserFlagBits(i) & (ADMFLAG_ROOT))
		{
			SendConVarValue(i, sv_cheats, "1");
		}
	}
}

public void OnClientPutInServer(int client)
{
	if(!IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_ROOT))
	{
		SendConVarValue(client, sv_cheats, "1");
	}
}

public void Event_Player_Spawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));
	
	if(!IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_ROOT))
	{
		SendConVarValue(client, sv_cheats, "1");
	}
}
AuricYoutube is offline
Sreaper
髪を用心
Join Date: Nov 2009
Old 06-22-2022 , 05:26   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #3

Quote:
Originally Posted by AuricYoutube View Post
untested:

Spoiler
Personally I just use this and haven't run into any errors.

Code:
ConVar g_cvCheats;
  
public void OnPluginStart()
{
    g_cvCheats = FindConVar("sv_cheats");
}


public void OnClientPostAdminCheck(int client)
{
    if (CheckCommandAccess(client, "sm_rcon", ADMFLAG_ROOT))
    {
		SendConVarValue(client, g_cvCheats, "1");
    }
}

Last edited by Sreaper; 06-22-2022 at 05:27.
Sreaper is offline
hellnecrotom
Junior Member
Join Date: Feb 2021
Old 06-22-2022 , 06:46   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #4

Quote:
Originally Posted by AuricYoutube View Post
untested:

Code:
#include <sourcemod>

Handle sv_cheats = null;

public void OnPluginStart()
{
	sv_cheats = FindConVar("sv_cheats");
	
	HookEvent("player_spawn", Event_Player_Spawn, EventHookMode_Post);
	for(int i = 1; i <= MaxClients; i++)
	{
		if(IsClientInGame(i) && !IsFakeClient(i) && GetUserFlagBits(i) & (ADMFLAG_ROOT))
		{
			SendConVarValue(i, sv_cheats, "1");
		}
	}
}

public void OnClientPutInServer(int client)
{
	if(!IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_ROOT))
	{
		SendConVarValue(client, sv_cheats, "1");
	}
}

public void Event_Player_Spawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));
	
	if(!IsFakeClient(client) && GetUserFlagBits(client) & (ADMFLAG_ROOT))
	{
		SendConVarValue(client, sv_cheats, "1");
	}
}
Yes, I tested this one - it does not compile unfortunately
hellnecrotom is offline
hellnecrotom
Junior Member
Join Date: Feb 2021
Old 06-22-2022 , 06:50   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #5

Quote:
Originally Posted by Sreaper View Post
Personally I just use this and haven't run into any errors.

Code:
ConVar g_cvCheats;
  
public void OnPluginStart()
{
    g_cvCheats = FindConVar("sv_cheats");
}


public void OnClientPostAdminCheck(int client)
{
    if (CheckCommandAccess(client, "sm_rcon", ADMFLAG_ROOT))
    {
		SendConVarValue(client, g_cvCheats, "1");
    }
}
This one actually compiles but I am missing something as it is not working.

The plugin loads successfully but whenever I can use cheats, so can my clients.

If sv_cheats is 1, then we can both use cheats.
If sv_cheats is 0, neither of us can use cheats.

Am I missing the point as to how to use the plugin?

Thanks for everything
hellnecrotom is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 06-22-2022 , 13:41   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #6

Quote:
Originally Posted by hellnecrotom View Post
Yes, I tested this one - it does not compile unfortunately
compiles for me
AuricYoutube is offline
Sreaper
髪を用心
Join Date: Nov 2009
Old 06-22-2022 , 14:10   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #7

Quote:
Originally Posted by hellnecrotom View Post
This one actually compiles but I am missing something as it is not working.

The plugin loads successfully but whenever I can use cheats, so can my clients.

If sv_cheats is 1, then we can both use cheats.
If sv_cheats is 0, neither of us can use cheats.

Am I missing the point as to how to use the plugin?

Thanks for everything
I’m not aware of other clients being also able to use cheats with this. Leave sv_cheats at 0 at all times. When you join the server it will allow you to use client cheats like mat_wireframe. It doesn’t touch any server sided ones like noclip. Which cheat are you specifically wanting for yourself that doesn’t work with this?

Also what game is this for?

Last edited by Sreaper; 06-22-2022 at 14:16.
Sreaper is offline
hellnecrotom
Junior Member
Join Date: Feb 2021
Old 06-22-2022 , 17:11   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #8

Oh, I am terribly sorry, I failed to post which game this was about.

It is L4D2.

If I enable sv_cheats 1, clients can also use cheats like noclip, respawn, etc.

I actually made a separate thread abou this here, relating it in detail: https://forums.alliedmods.net/showth...35#post2782135

In essence, I am trying to use cheats alone - so no one else can do it, but me, the admin/host.
hellnecrotom is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 06-23-2022 , 09:17   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #9

Quote:
Originally Posted by hellnecrotom View Post
Oh, I am terribly sorry, I failed to post which game this was about.

It is L4D2.

If I enable sv_cheats 1, clients can also use cheats like noclip, respawn, etc.

I actually made a separate thread abou this here, relating it in detail: https://forums.alliedmods.net/showth...35#post2782135

In essence, I am trying to use cheats alone - so no one else can do it, but me, the admin/host.
Quote:
Originally Posted by hellnecrotom View Post
Yes, I tested this one - it does not compile unfortunately
I do not know why it did not compile for you. Try the webcompiler below.
Attached Files
File Type: sp Get Plugin or Get Source (admincheat.sp - 154 views - 831 Bytes)
AuricYoutube is offline
hellnecrotom
Junior Member
Join Date: Feb 2021
Old 06-23-2022 , 14:52   Re: sv_cheats ONLY FOR HOST / ADMIN
Reply With Quote #10

Hey there, thanks, I actually managed to compile it.

Sorry to miss the obvious, but how would I use this?

Does this turn on sv_cheats only for me?

Thanks for the help
hellnecrotom is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode