View Single Post
Teamkiller324
Senior Member
Join Date: Feb 2014
Location: Earth
Old 07-11-2020 , 21:04   Re: Return command value
Reply With Quote #3

Thanks, got it working with something like this:

Code:
#pragma		semicolon 1
#include	<sourcemod>
#include	<multicolors>

new		Handle:TestCmd = INVALID_HANDLE;

public	OnPluginStart()
{
	TestCmd	=	FindConVar("bot_forceattack");
	RegAdminCmd("sm_testing",	CommandTesting, ADMFLAG_ROOT);
}

public Action:CommandTesting(client, args)
{
	ServerCommand("toggle bot_forceattack");
	{
		if (GetConVarInt(TestCmd) == 1)
		{
			CPrintToChat(client, "bot_forceattack value turned off"); // If 0, print turned off
		}
		else if (GetConVarInt(TestCmd) == 0)
		{
			CPrintToChat(client, "bot_forceattack value turned on"); // If 1, print turned on
		}
	}
	return Plugin_Handled;
}
Inverted 0 and 1 for getting the ConVarInt for TestCmd is working correctly for some reason. doing vice versa will make it do bot_forceattack 1 when "off" and bot_forceattack 0 when "on"
__________________

Last edited by Teamkiller324; 07-12-2020 at 08:51.
Teamkiller324 is offline