Raised This Month: $56 Target: $400
 14% 

[Edit] register_clcmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VenomMix
Member
Join Date: Nov 2018
Old 03-13-2019 , 08:38   [Edit] register_clcmd
Reply With Quote #1

I have this:
HTML Code:
        register_clcmd("say !mix", 			"ShowWarMenu", 	ADMIN_ACCESS);
	register_clcmd("say !alegeri", 		"Alegeri", 		ADMIN_ACCESS);
	register_clcmd("say !lame", 		"Lame", 		ADMIN_ACCESS);
	register_clcmd("say !warm", 		"Warm", 		ADMIN_ACCESS);
	register_clcmd("say !live", 		"Live", 		ADMIN_ACCESS);
	register_clcmd("say !rr", 			"Rr", 			ADMIN_ACCESS);
And I'd like commands to go with "!" and with "/" but without writing an order with "!" and one with "/".
VenomMix is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: I am living in house bsd
Old 03-13-2019 , 10:04   Re: [Edit] register_clcmd
Reply With Quote #2

i dont understand ? you wanted both "say !mix" & "say /mix" ?
SHIELD755 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-13-2019 , 11:21   Re: [Edit] register_clcmd
Reply With Quote #3

Quote:
Originally Posted by VenomMix View Post
I have this:
HTML Code:
        register_clcmd("say !mix", 			"ShowWarMenu", 	ADMIN_ACCESS);
	register_clcmd("say !alegeri", 		"Alegeri", 		ADMIN_ACCESS);
	register_clcmd("say !lame", 		"Lame", 		ADMIN_ACCESS);
	register_clcmd("say !warm", 		"Warm", 		ADMIN_ACCESS);
	register_clcmd("say !live", 		"Live", 		ADMIN_ACCESS);
	register_clcmd("say !rr", 			"Rr", 			ADMIN_ACCESS);
And I'd like commands to go with "!" and with "/" but without writing an order with "!" and one with "/".
PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_cmd("mix",             "ShowWarMenu",     ADMIN_ACCESS);
    
register_cmd("alegeri",         "Alegeri",         ADMIN_ACCESS);
    
register_cmd("lame",         "Lame",         ADMIN_ACCESS);
    
register_cmd("warm",         "Warm",         ADMIN_ACCESS);
    
register_cmd("live",         "Live",         ADMIN_ACCESS);
    
register_cmd("rr",             "Rr",             ADMIN_ACCESS)
}



register_cmd(const clcmd[], const function[], flags = -1, const info[] = ""FlagManager = -1)
{
    new 
cmdToRegister[6][64];
    
    
formatex(cmdToRegister[0], charsmax(cmdToRegister[]), "say !%s"clcmd)
    
formatex(cmdToRegister[1], charsmax(cmdToRegister[]), "say .%s"clcmd)
    
formatex(cmdToRegister[2], charsmax(cmdToRegister[]), "say /%s"clcmd)
    
formatex(cmdToRegister[3], charsmax(cmdToRegister[]), "say_team !%s"clcmd)
    
formatex(cmdToRegister[4], charsmax(cmdToRegister[]), "say_team .%s"clcmd)
    
formatex(cmdToRegister[5], charsmax(cmdToRegister[]), "say_team /%s"clcmd)
    
    for ( new 
sizeof(cmdToRegister) ; i++ )
        
register_clcmd(cmdToRegister[i], function, flagsinfoFlagManager)

__________________

Last edited by iceeedr; 03-13-2019 at 12:20.
iceeedr is online now
Send a message via Skype™ to iceeedr
VenomMix
Member
Join Date: Nov 2018
Old 03-13-2019 , 12:10   Re: [Edit] register_clcmd
Reply With Quote #4

is good, but i found an error: register_cmd is never used.
VenomMix is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-13-2019 , 12:20   Re: [Edit] register_clcmd
Reply With Quote #5

Quote:
Originally Posted by VenomMix View Post
is good, but i found an error: register_cmd is never used.
Edited, see my post above.
__________________
iceeedr is online now
Send a message via Skype™ to iceeedr
VenomMix
Member
Join Date: Nov 2018
Old 03-13-2019 , 12:56   Re: [Edit] register_clcmd
Reply With Quote #6

Thank you for understanding what I meant and for the help you gave me. It's perfect.
VenomMix is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 03-13-2019 , 15:15   Re: [Edit] register_clcmd
Reply With Quote #7

Quote:
Originally Posted by iceeedr View Post
PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_cmd("mix",             "ShowWarMenu",     ADMIN_ACCESS);
    
register_cmd("alegeri",         "Alegeri",         ADMIN_ACCESS);
    
register_cmd("lame",         "Lame",         ADMIN_ACCESS);
    
register_cmd("warm",         "Warm",         ADMIN_ACCESS);
    
register_cmd("live",         "Live",         ADMIN_ACCESS);
    
register_cmd("rr",             "Rr",             ADMIN_ACCESS)
}



register_cmd(const clcmd[], const function[], flags = -1, const info[] = ""FlagManager = -1)
{
    new 
cmdToRegister[6][64];
    
    
formatex(cmdToRegister[0], charsmax(cmdToRegister[]), "say !%s"clcmd)
    
formatex(cmdToRegister[1], charsmax(cmdToRegister[]), "say .%s"clcmd)
    
formatex(cmdToRegister[2], charsmax(cmdToRegister[]), "say /%s"clcmd)
    
formatex(cmdToRegister[3], charsmax(cmdToRegister[]), "say_team !%s"clcmd)
    
formatex(cmdToRegister[4], charsmax(cmdToRegister[]), "say_team .%s"clcmd)
    
formatex(cmdToRegister[5], charsmax(cmdToRegister[]), "say_team /%s"clcmd)
    
    for ( new 
sizeof(cmdToRegister) ; i++ )
        
register_clcmd(cmdToRegister[i], function, flagsinfoFlagManager)

PHP Code:
// thanks to mx?! (BlackSignature)
stock register_saycmd(const szSayCmd[], const szFunc[], iFlags = -1, const szInfo[] = ""FlagManager = -1bool:bInfoML false)
{
    new const 
szPrefix[][] = { "say /""say_team /""say .""say_team ." };

    for(new 
iszTemp[32]; sizeof(szPrefix); i++)
    {
        
formatex(szTempcharsmax(szTemp), "%s%s"szPrefix[i], szSayCmd);
        
register_clcmd(szTempszFunciFlagsszInfoFlagManagerbInfoML);
    }

__________________

Last edited by eat1k; 03-13-2019 at 15:18.
eat1k is offline
VenomMix
Member
Join Date: Nov 2018
Old 03-13-2019 , 16:55   Re: [Edit] register_clcmd
Reply With Quote #8

Before or after register_clcmd?
Give me an example with a random command.

Last edited by VenomMix; 03-13-2019 at 16:57.
VenomMix is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-13-2019 , 17:02   Re: [Edit] register_clcmd
Reply With Quote #9

Quote:
Originally Posted by VenomMix View Post
Before or after register_clcmd?
Give me an example with a random command.
PHP Code:
public plugin_init() {
    
    
register_saycmd("mix",             "ShowWarMenu",     ADMIN_ACCESS);
    
register_saycmd("alegeri",         "Alegeri",         ADMIN_ACCESS);
    
register_saycmd("lame",         "Lame",         ADMIN_ACCESS);
    
register_saycmd("warm",         "Warm",         ADMIN_ACCESS);
    
register_saycmd("live",         "Live",         ADMIN_ACCESS);
    
register_saycmd("rr",             "Rr",             ADMIN_ACCESS)
}



stock register_saycmd(const szSayCmd[], const szFunc[], iFlags = -1, const szInfo[] = ""FlagManager = -1bool:bInfoML false)
{
    new const 
szPrefix[][] = { "say /""say_team /""say .""say_team .""say !""say_team !" };

    for(new 
iszTemp[32]; sizeof(szPrefix); i++)
    {
        
formatex(szTempcharsmax(szTemp), "%s%s"szPrefix[i], szSayCmd);
        
register_clcmd(szTempszFunciFlagsszInfoFlagManagerbInfoML);
    }

@eat1k

Thanks for the stock.
__________________
iceeedr is online now
Send a message via Skype™ to iceeedr
eat1k
Senior Member
Join Date: Apr 2018
Old 03-13-2019 , 19:10   Re: [Edit] register_clcmd
Reply With Quote #10

In addition, we have this:

PHP Code:
const MAX_CMD_LEN 32;

new const 
g_szCmds[] = "menu, vipmenu";
new const 
szPreCmd[][] = {"say ""say_team """};
new const 
szCtrlChar[][] = {"!""/""\", ".", ""};
new const FUNC_NAME[] = "
Show_Menu";

Init_Cmds()
{
    if(strlen(g_szCmds))
    {
        for(new i; i < sizeof(szPreCmd); i++)
        {
            for(new k; k < sizeof(szCtrlChar); k++)
            {
                new szCmd[MAX_CMD_LEN], ePos, stPos, rawPoint[32];
 
                do
                {
                    ePos = strfind(g_szCmds[stPos],"
,");
                    formatex(rawPoint, ePos, g_szCmds[stPos]);
                    stPos += ePos + 1;
    
                    trim(rawPoint);
    
                    if(rawPoint[0])
                    {
                        formatex(szCmd, charsmax(szCmd),
                            "
%s%s%s",
                            szPreCmd,
                            szCtrlChar[k],
                            rawPoint
                        );
                            
                        register_clcmd(szCmd, FUNC_NAME);
                    }
                }
                while(ePos != -1)
            }
        }
    }

Source: https://dev-cs.ru/threads/222/#post-8937 (by wopox1337)
__________________

Last edited by eat1k; 03-13-2019 at 19:11.
eat1k 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 22:12.


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