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

[REQ] Print message if client has convar value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sreaper
髪を用心
Join Date: Nov 2009
Old 01-02-2021 , 23:34   [REQ] Print message if client has convar value
Reply With Quote #1

If someone wouldn't mind making this I would appreciate it. Basically some maps for whatever reason require r_rootlod set to 0 or they will crash the clients to desktop in certain areas. I'm seeking a plugin that repeatedly warns any client on a repeating timer to change the value if they do not have r_rootlod set to 0 (high model quality). (0, 1, 2) are all of the values the cvar has. Thank you for reading.
Sreaper is offline
AePT
Member
Join Date: Jan 2016
Old 01-03-2021 , 10:55   Re: [REQ] Print message if client has convar value
Reply With Quote #2

I think that ConVar is from TF2 so I did this, but didn't test it.

PHP Code:
#include <sourcemod>

public Plugin myinfo =
{
    
name "[TF2] Check Client ConVar",
    
author "sekm",
    
description "Check if Client ConVar r_rootlod is 0",
    
version "1.0",
    
url "https://steamcommunity.com/id/h5r/"
};

public 
void OnPluginStart()
{
    if (
GetEngineVersion() != Engine_TF2)
        
SetFailState("This plugin only for TF2!");
}

public 
void OnClientPutInServer(int iClient)
{
    
CreateTimer(2.3Timer_CheckClientConVarGetClientUserId(iClient), TIMER_REPEAT);
}

public 
Action Timer_CheckClientConVar(Handle hTimerint iUserId)
{
    
int iClient GetClientOfUserId(iUserId);
    
    if (!
IsClientInGame(iClient))
        return 
Plugin_Stop;
    
    
QueryClientConVar(iClient"r_rootlod"QueryClient_ConVariClient);
    return 
Plugin_Continue;
}

public 
void QueryClient_ConVar(QueryCookie qCookieint iClientConVarQueryResult qResult, const char[] sCVarName, const char[] sCVarValue)
{
    if (!
StrEqual(sCVarValue"0"))
    {
        
PrintToChat(iClient" You must set \x04r_rootlod\x01 to \x040\x01 or your game may crash.");
    }

Greetings!

Last edited by AePT; 01-03-2021 at 23:28.
AePT is offline
Sreaper
髪を用心
Join Date: Nov 2009
Old 01-03-2021 , 22:51   Re: [REQ] Print message if client has convar value
Reply With Quote #3

Quote:
Originally Posted by AePT View Post
I think that ConVar is from TF2 so I did this, but didn't test it.

PHP Code:
#include <sourcemod>

public Plugin myinfo =
{
    
name "[TF2] Check Client ConVar",
    
author "PM",
    
description "Check if Client ConVar r_rootlod is 0",
    
version "1.0",
    
url "https://steamcommunity.com/id/h5r/"
};

public 
void OnPluginStart()
{
    if (
GetEngineVersion() != Engine_TF2)
        
SetFailState("This plugin only for TF2!");
}

public 
void OnClientPutInServer(int iClient)
{
    
CreateTimer(2.3Timer_CheckClientConVarGetClientUserId(iClient), TIMER_REPEAT);
}

public 
Action Timer_CheckClientConVar(Handle hTimerint iUserId)
{
    
int iClient GetClientOfUserId(iUserId);
    
    if (!
IsClientInGame(iClient))
        return 
Plugin_Stop;
    
    
QueryClientConVar(iClient"r_rootlod"QueryClient_ConVariClient);
    return 
Plugin_Continue;
}

public 
void QueryClient_ConVar(QueryCookie qCookieint iClientConVarQueryResult qResult, const char[] sCVarName, const char[] sCVarValue)
{
    if (!
StrEqual(sCVarValue"0"))
    {
        
PrintToChat(iClient" You must set \x04r_rootlod\x01 to \x040\x01 or your game may crash.");
    }

Greetings!
Thank you very much!
Sreaper 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 05:02.


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