This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[HELP] Command Change by Cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 11-18-2016 , 08:34   [HELP] Command Change by Cvar
Reply With Quote #1

Hi all

any one make this
PHP Code:
register_clcmd("say /test""ShowMenu"_"Test Menu"); 
code like admins change a say /test by cvar i mean

Admins change this on server by Cvar i want a prefix ;) add please...

Exapmle :
command_prefix "say /test"
command_prefix "say /Make"

CHANGED BY CVAR

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("My Menu""1.0""Me");
    
register_clcmd("say /test""ShowMenu"_"Test Menu");
}

public 
ShowMenu(id)
{
    new 
menu menu_create("MyMenu""mh_MyMenu");

    
menu_additem(menu"Hi tesr plugin :)"""0); // case 0

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
mh_MyMenu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0client_print(idprint_chat"You have selected Hi tesr plugin :)");
    }

    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;

Sorry For My Bad English

Last edited by shehzad1234; 11-18-2016 at 08:35.
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 11-18-2016 , 13:27   Re: [HELP] Command Change by Cvar
Reply With Quote #2

Please Help me
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
Artifact
Veteran Member
Join Date: Jul 2010
Old 11-18-2016 , 13:31   Re: [HELP] Command Change by Cvar
Reply With Quote #3

You really need to learn english
I think you need something like this?
PHP Code:
#include <amxmodx>

new cvarPrefix

public plugin_init()
{
    
register_plugin("My Menu""1.0""Me");
    new 
clcmd[30]
    
get_pcvar_string(cvarPrefixclcmdcharsmax(clcmd))
    
register_clcmd(clcmd"ShowMenu"_"Test Menu");
}

public 
plugin_cfg()
    
cvarPrefix register_cvar("command_prefix""say /test")

public 
ShowMenu(id)
{
    new 
menu menu_create("MyMenu""mh_MyMenu");
    
    
menu_additem(menu"Hi tesr plugin :)"""0); // case 0
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
mh_MyMenu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
command[6], name[64], accesscallback;
    
    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);
    
    switch(
item)
    {
        case 
0client_print(idprint_chat"You have selected Hi tesr plugin :)");
        }
    
    
menu_destroy(menu);
    
    return 
PLUGIN_HANDLED;

__________________

Last edited by Artifact; 11-18-2016 at 13:31.
Artifact is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 11-18-2016 , 14:35   Re: [HELP] Command Change by Cvar
Reply With Quote #4

Quote:
Originally Posted by Artifact View Post
You really need to learn english
I think you need something like this?
PHP Code:
#include <amxmodx>

new cvarPrefix

public plugin_init()
{
    
register_plugin("My Menu""1.0""Me");
    new 
clcmd[30]
    
get_pcvar_string(cvarPrefixclcmdcharsmax(clcmd))
    
register_clcmd(clcmd"ShowMenu"_"Test Menu");
}

public 
plugin_cfg()
    
cvarPrefix register_cvar("command_prefix""say /test")

public 
ShowMenu(id)
{
    new 
menu menu_create("MyMenu""mh_MyMenu");
    
    
menu_additem(menu"Hi tesr plugin :)"""0); // case 0
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
mh_MyMenu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
command[6], name[64], accesscallback;
    
    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);
    
    switch(
item)
    {
        case 
0client_print(idprint_chat"You have selected Hi tesr plugin :)");
        }
    
    
menu_destroy(menu);
    
    return 
PLUGIN_HANDLED;

Not working
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 11-18-2016 , 14:47   Re: [HELP] Command Change by Cvar
Reply With Quote #5

@Artifact

L 11/19/2016 - 00:470: [AMXX] Run time error 10 (plugin "menushehzad.amxx") (native "get_pcvar_num") - debug not enabled!
L 11/19/2016 - 00:470: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 11/19/2016 - 00:50:23: Start of error session.

:/
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-18-2016 , 16:32   Re: [HELP] Command Change by Cvar
Reply With Quote #6

What i understand:
You want to change the command with a cvar?

I dont know if this work:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new iCvarCommand

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
iCvarCommand register_cvar("command_prefix","/test")
    
    
register_clcmd("say","CmdCommand")
}
public 
CmdCommand(id)
{
    new 
iWords[11]
    
read_argv(1,iWords,10)
    
    new 
iCvar[32]
    
get_pcvar_string(iCvarCommand,iCvar,charsmax(iCvar))
    
    if(
equal(iWords[0],iCvar))
    {
        
// do something
    
}

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 11-18-2016 at 16:33.
EFFx is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 11-19-2016 , 02:03   Re: [HELP] Command Change by Cvar
Reply With Quote #7

admins change Command by cvar i mean
admins change say /test to say /like so players type /test to menu not on only players type /like to menu on but Command change by cvar


Sorry for bad english
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 11-19-2016 , 11:40   Re: [HELP] Command Change by Cvar
Reply With Quote #8

BUMP
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-19-2016 , 17:35   Re: [HELP] Command Change by Cvar
Reply With Quote #9

I can't understand nothing. And i think all members here think the same, try google translate please.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-19-2016 , 17:42   Re: [HELP] Command Change by Cvar
Reply With Quote #10

Why did you ignore EFFx's code? It does exactly what you want.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



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 16:14.


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