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

Add new Convar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Harry56
Junior Member
Join Date: Jun 2018
Old 10-18-2018 , 13:54   Add new Convar
Reply With Quote #1

Hi
I want create new Command for players
like test_test , and get value ( like test_test 1 , test_test 2 , etc ... )
and this command do nothing.
can anyone help?
Harry56 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-18-2018 , 15:33   Re: Add new Convar
Reply With Quote #2

ConVar = Console Variable
- This is setting/option. ex. mp_gravity, sv_cheats etc. etc.
- You can create these cvars with SourceMod to Source Dedicated Server, but not for players.

Cmd = Command
- This is like "trigger", what launch action or some code. ex. +duck, -duck, noclip, say, sm_help etc. etc.
- You can create these cmds to SRCDS and for players.


To save players settings: use ClientPrefs ( [Tutorial] ClientPrefs )
__________________
Do not Private Message @me
Bacardi is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 10-26-2018 , 05:23   Re: Add new Convar
Reply With Quote #3

Harry56, do you mean chat command, like
Quote:
!test 1
?

Code:
public void OnPluginStart()
{
	RegConsoleCmd("sm_test", Cmd_Test, "Description");
}

public Action Cmd_Test(int client, int args)
{
	if (args < 1)
	{
		PrintToChat(client, "[SM] Usage: !test <Number>");
		return Plugin_Handled;
	}
	char arg[5];
	GetCmdArg(1, arg, sizeof(arg));
	int num = StringToInt(arg);
	
	PrintToChat(client, "[SM] You are selected number %i", num);

	return Plugin_Handled;
}
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 04:40.


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