Raised This Month: $18 Target: $400
 4% 

Return command value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Teamkiller324
Member
Join Date: Feb 2014
Location: sverige, örebro
Old 07-10-2020 , 23:04   Return command value
Reply With Quote #1

What function should i use to return the command value? such as return if server_cvar is 0, it will allow test1 text to go trough and if server_cvar is 1, it will allow test2 text to go trough.
__________________
[TF2/ANY] Suppress Manager

Steam

Working on a large compact plugin.
Under Construction
Teamkiller324 is offline
Send a message via Skype™ to Teamkiller324
Teamkiller324
Member
Join Date: Feb 2014
Location: sverige, örebro
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"
__________________
[TF2/ANY] Suppress Manager

Steam

Working on a large compact plugin.
Under Construction

Last edited by Teamkiller324; 07-12-2020 at 08:51.
Teamkiller324 is offline
Send a message via Skype™ to Teamkiller324
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 03:38.


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