Raised This Month: $32 Target: $400
 8% 

[ANY] ADVANCED and silent CVAR change [AGO 2019]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
axelnieves2012
Senior Member
Join Date: Oct 2014
Location: Argentina
Plugin ID:
6662
Plugin Version:
1.1
Plugin Category:
Admin Commands
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    115 
    Plugin Description:
    Alternate sm_cvar. Allows you to change a cvar value without printing any result to chat. Opcionaly, you can print result to console or server; and/or add a delay.
    Old 07-30-2019 , 02:31   [ANY] ADVANCED and silent CVAR change [AGO 2019]
    Reply With Quote #1

    WELCOME

    INTRODUCTION:
    For months I've been looking for a way to get rid of those annoying chat reports whenever a CVAR changed (requested by admin, automatic plugins, etc), and I've not found a working solution.
    So I made this plugin.

    DESCRIPTION:
    This plugin adds new commands which replace sm_cvar, with the same functionality, and no chat spamming (it even works on FCVAR_NOTIFY convars).

    BONUS 1: You can also print result to server console. And you can also add a delay before a cvar is changed.
    *NEW*: Now you can set a cvar pointing to another cvar's value.

    INFO:
    Delay must be given as float string. 1.0=1 second // 0.5=half second.
    If omited, or <=0.0, plugin will change your cvar inmediatelly.

    REQUERIMENTS:
    - Sourcemod >= 1.9

    Change log:
    Version 1.1 [1 AGO 2019]
    - Added ability to set a cvar pointing to another cvar's value.
    Version 1.0 [30 JUL 2019] (23 downloads)
    - Initial release.

    Convars:
    PHP Code:
    sm_acvar_server_always "1"
    Print always result to server console when using sm_acvar and sm_adcvarIt`s a good idea enabling it if you pretend to use "sm_acvar" replacing "sm_cvar". 
    Admin commands:
    PHP Code:
    sm_acvar convar_name "convar value".
    Changes a cvar value without printing result to chatnor consolenor serverResult will be printed to server if sm_acvar_always is enabled.

    sm_acvar_console convar_name "convar value".
    Changes a cvar value printing result to admin`s console only. This command is not affected by sm_acvar_always.

    sm_acvar_server convar_name "convar value".
    Changes a cvar value printing result to server
    `s console only.

    sm_adcvar float:delay=0.0 convar_name "convar value".
    Changes a cvar value without printing result to chatnor consolenor serverCVar will be changed after specified delayResult will be printed to server if sm_acvar_always is enabled.

    sm_adcvar_console float:delay=0.0 convar_name "convar value".
    Changes a cvar value printing result to admin`s console only. CVar will be changed after specified delay. This command is not affected by sm_acvar_always.

    sm_adcvar_server float:delay=0.0 convar_name "convar value".
    Changes a cvar value printing result to server
    `s console onlyCVar will be changed after specified delay
    Console commands:
    No user commands implemented.

    Known bugs:
    - None at the moment. Please, report here.

    To do list:
    - Post suggestions here.

    Using CVar pointing to another CVar value:
    To set a cvar to another cvar's value, you should pass its name prepended by a dollar sign, AT THE VERY BEGINING OF THE ARGUMENT.
    Example 1:
    Code:
    sm_acvar mp_footsteps $mp_flashlight
    You can only point to one cvar per command.
    Above example will set "mp_footsteps" according to mp_flashlight's value.

    Example 2 (This is wrong):
    Code:
    sm_acvar hostname "welcome to $mp_gamemode"
    This will not work because you cannot point to a cvar in a mid-string.

    If you want to use a dollar sign at the begining of a string, and it doesnt be parsed as a cvar, you should use a double dollar sign to override its functionality.

    Example 3:
    Code:
    sm_acvar hostname "$$peedfire"
    Above code will set "hostname" to "$speedfire".


    Examples:
    sm_acvar sv_cheats 1
    Changes 'sv_cheats' to '1' without any chat message.
    sm_acvar_server hostname "L4D1 TANK RUSH 24/7"
    Changes 'hostname' to 'L4D1 TANK RUSH 24/7' and prints result to server console only.
    sm_adcvar_server 5.0 mp_friendlyfire 1
    Will change 'mp_friendlyfire' to '1' within next 5 seconds after command is entered. And result will be printed to serverīs console.
    sm_adcvar 0.1 sv_gametypes "coop, versus, teamversus"
    Will change 'sv_gametypes' to 'coop, versus, teamversus' within next 0.1 second after command is entered.
    Examples pointing to another cvar value:
    sm_acvar z_hunter_limit $survivor_limit
    Will set z_hunter_limit to survivor_limit's current value.
    sm_acvar mp_freezetime $mp_buytime
    Will set mp_freezetime to mp_buytime's current value.
    sm_acvar hostname "$$uPeR cR4zy $erVer"
    Will set hostname to $uPeR cR4zy $erver.
    IMPORTANT: In this example, only $$uPeR needs double '$' to avoid cvar pointing. $erVer doesn't need double dollar sign because it's not at the very begining of the string.
    Beta testing versions:
    - Beta testing versions will be posted here.
    The purpose of this is posting my work progress oftenly. They may include unused code, unstable behaviors, non-working features, and some stuff can be removed on next official release.
    Click "show" for BETA versions:
    Spoiler


    Official last version:
    Attached Files
    File Type: sp Get Plugin or Get Source (sm_acvar.sp - 1218 views - 6.4 KB)

    Last edited by axelnieves2012; 03-18-2021 at 00:48.
    axelnieves2012 is offline
    aykocity
    Member
    Join Date: Sep 2017
    Old 07-30-2019 , 19:19   Re: [ANY] ADVANCED and silent CVAR change [JUL 2019]
    Reply With Quote #2

    hi;

    Quote:
    I have some requests

    Example:
    sm_adcvar_server 30.0 sm_blind @all 300
    sm_adcvar_server 50.0 sm_blind @all 0

    and reset each round
    thanks for sharing

    Last edited by aykocity; 07-30-2019 at 19:20.
    aykocity is offline
    axelnieves2012
    Senior Member
    Join Date: Oct 2014
    Location: Argentina
    Old 07-30-2019 , 22:51   Re: [ANY] ADVANCED and silent CVAR change [JUL 2019]
    Reply With Quote #3

    Quote:
    Originally Posted by aykocity View Post
    hi;



    thanks for sharing
    Hello, I cannot understand your request. Can you explain me, please?
    I know a plugin that reloads current map (sm_reloadmap command).
    And I know a plugins that execs commands with delay (sm_delaycmd command).
    You can combine them:
    sm_delaycmd 5.0 sm_reloadmap.

    Is this what you are looking for?
    axelnieves2012 is offline
    aykocity
    Member
    Join Date: Sep 2017
    Old 07-31-2019 , 09:28   Re: [ANY] ADVANCED and silent CVAR change [JUL 2019]
    Reply With Quote #4

    no

    Quote:
    example:

    in de.cfg

    1.round
    sm_adcvar_server 30.0 sm_blind @all 300
    sm_adcvar_server 50.0 sm_blind @all 0

    2.round
    sm_adcvar_server 30.0 sm_blind @all 300
    sm_adcvar_server 50.0 sm_blind @all 0

    3.4.5.6.... etc..
    currently only works when the map is newly opened
    next rounds not working
    aykocity is offline
    axelnieves2012
    Senior Member
    Join Date: Oct 2014
    Location: Argentina
    Old 07-31-2019 , 22:56   Re: [ANY] ADVANCED and silent CVAR change [JUL 2019]
    Reply With Quote #5

    Quote:
    Originally Posted by aykocity View Post
    no :(



    currently only works when the map is newly opened
    next rounds not working
    Hello. I think you may be confused. As I could see, "sm_blind" is a command.
    This script manages CONVARS, not commands.
    Tell me exactly what are you trying to do. Maybe you are using this plugin by mistake.

    I think you should do is:
    Code:
    sm_delaycmd 30.0 sm_blind @all 300
    sm_delaycmd 50.0 sm_blind @all 0
    In above code, you should know that both 'sm_delaycmd' commands are executed at the same time. This means that if you executed your CFG at 00:00:00s, you will blind @all at 0:00:30s. And @all will be unblinded at 0:00:50s, not at 0:01:20s.

    You should also use a plugin that automatically loads your CFG on each round.
    listenserver.cfg and server.cfg are executed on each mapchange, not on each new round.

    Last edited by axelnieves2012; 08-01-2019 at 01:27.
    axelnieves2012 is offline
    Mi.Cura
    Veteran Member
    Join Date: Dec 2016
    Location: Brazil
    Old 01-19-2020 , 12:51   Re: [ANY] ADVANCED and silent CVAR change [AGO 2019]
    Reply With Quote #6

    Great job, works well and is very useful.
    Thank you for sharing this solution.

    __________________
    Mi.Cura | Modded Servers | L4D2
    https://steamcommunity.com/groups/micuramodzombie
    Mi.Cura is offline
    alphaearth
    Senior Member
    Join Date: Feb 2018
    Location: Turkey
    Old 01-19-2020 , 13:23   Re: [ANY] ADVANCED and silent CVAR change [AGO 2019]
    Reply With Quote #7

    I no longer need to change the codes of the plugins.

    Code:
    SetCvar("mp_maxrounds", 30);
    SetCvar("mp_maxmoney", 16000);
    SetCvar(char cvarName[64], value)
    {
    	Handle IntCvar;
    	IntCvar = FindConVar(cvarName);
    	if (IntCvar)
    	{
    		int flags = GetConVarFlags(IntCvar);
    		flags &= -257;
    		SetConVarFlags(IntCvar, flags);
    		SetConVarInt(IntCvar, value, false, false);
    		flags |= 256;
    		SetConVarFlags(IntCvar, flags);
    	}
    }
    __________________
    alphaearth is offline
    Tonblader
    Senior Member
    Join Date: Jul 2011
    Location: Peru
    Old 03-14-2021 , 14:46   Re: [ANY] ADVANCED and silent CVAR change [AGO 2019]
    Reply With Quote #8

    Quote:
    Originally Posted by axelnieves2012 View Post
    sm_adcvar_server 5.0 mp_friendlyfire 1
    When the game restarts, round ends, round restarts, opens server, closes server, changes map, etc, is there any command to deactivate all the commands that were sent to be executed in the future?

    [Any] Delay Command

    Last edited by Tonblader; 04-08-2021 at 07:59.
    Tonblader is offline
    axelnieves2012
    Senior Member
    Join Date: Oct 2014
    Location: Argentina
    Old 03-17-2021 , 23:21   Re: [ANY] ADVANCED and silent CVAR change [AGO 2019]
    Reply With Quote #9

    Quote:
    Originally Posted by Tonblader View Post
    When the game restarts, round ends, round restarts, opens server, closes server, changes map, is there any command to deactivate all the commands that were sent to be executed in the future?

    [Any] Delay Command
    Hello, I think this is easy. I have abandoned programming for long time. But I think I can post a Beta testing version for your needings. Maybe I will release it in the future. Stay tunned ^uwu^
    axelnieves2012 is offline
    axelnieves2012
    Senior Member
    Join Date: Oct 2014
    Location: Argentina
    Old 03-18-2021 , 00:35   Re: [ANY] ADVANCED and silent CVAR change [AGO 2019]
    Reply With Quote #10

    Quote:
    Originally Posted by Tonblader View Post
    When the game restarts, round ends, round restarts, opens server, closes server, changes map, is there any command to deactivate all the commands that were sent to be executed in the future?

    [Any] Delay Command
    I think it's done, but I haven't tested.
    Check new file on top, under section: "Beta testing versions".
    Please, tell me if this is ok. It hooks two Left4Dead events. I dont remember if this may be conflictive with other games.

    You must now set sm_acvar_override_flags

    Last edited by axelnieves2012; 03-18-2021 at 00:45.
    axelnieves2012 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 15:08.


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