AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Add new Convar (https://forums.alliedmods.net/showthread.php?t=311458)

Harry56 10-18-2018 13:54

Add new Convar
 
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?

Bacardi 10-18-2018 15:33

Re: Add new Convar
 
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 )

Dragokas 10-26-2018 05:23

Re: Add new Convar
 
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;
}



All times are GMT -4. The time now is 06:37.

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