AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   sv_cheats ONLY FOR HOST / ADMIN (https://forums.alliedmods.net/showthread.php?t=338260)

hellnecrotom 06-22-2022 03:56

sv_cheats ONLY FOR HOST / ADMIN
 
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.

AuricYoutube 06-22-2022 04:32

Re: sv_cheats ONLY FOR HOST / ADMIN
 
Quote:

Originally Posted by hellnecrotom (Post 2782115)
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");
        }
}


Sreaper 06-22-2022 05:26

Re: sv_cheats ONLY FOR HOST / ADMIN
 
Quote:

Originally Posted by AuricYoutube (Post 2782117)
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");
    }
}


hellnecrotom 06-22-2022 06:46

Re: sv_cheats ONLY FOR HOST / ADMIN
 
Quote:

Originally Posted by AuricYoutube (Post 2782117)
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 06-22-2022 06:50

Re: sv_cheats ONLY FOR HOST / ADMIN
 
Quote:

Originally Posted by Sreaper (Post 2782124)
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

AuricYoutube 06-22-2022 13:41

Re: sv_cheats ONLY FOR HOST / ADMIN
 
Quote:

Originally Posted by hellnecrotom (Post 2782129)
Yes, I tested this one - it does not compile unfortunately :(

compiles for me

Sreaper 06-22-2022 14:10

Re: sv_cheats ONLY FOR HOST / ADMIN
 
Quote:

Originally Posted by hellnecrotom (Post 2782130)
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?

hellnecrotom 06-22-2022 17:11

Re: sv_cheats ONLY FOR HOST / ADMIN
 
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.

AuricYoutube 06-23-2022 09:17

Re: sv_cheats ONLY FOR HOST / ADMIN
 
1 Attachment(s)
Quote:

Originally Posted by hellnecrotom (Post 2782164)
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 (Post 2782164)
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.

hellnecrotom 06-23-2022 14:52

Re: sv_cheats ONLY FOR HOST / ADMIN
 
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


All times are GMT -4. The time now is 00:58.

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