AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Fun mod command error (https://forums.alliedmods.net/showthread.php?t=307570)

Heypio 05-15-2018 16:05

Fun mod command error
 
plugin enabled command not working.Where is the problem ?

Note: plugin enable, writing not say.

I apologize for my english


Commands
Code:

       
RegAdminCmd("sm_funmodenable", Command_PluginEnable, ADMFLAG_KICK);
RegAdminCmd("sm_funmoddisable", Command_PluginDisable, ADMFLAG_KICK);

Code:

public Action:Command_PluginEnable(client, args) {
       
        new String:arg[3];
        GetCmdArg(1, arg, sizeof(arg));
        int EnableNumber = StringToInt(arg);

        if(EnableNumber == 1) {
                g_EnablePluginu = true;
                PrintToChatAll("Plugin enabled!"); 
          }       
}

public Action:Command_PluginDisable(client, args) {
        new String:arg[3];
        GetCmdArg(1, arg, sizeof(arg));
        int EnableNumber = StringToInt(arg);
       
    if(EnableNumber == 0) {
                g_EnablePluginu = false;
                PrintToChatAll("Plugin disabled!");       
          }         
}


Indarello 05-16-2018 16:02

Re: Fun mod command error
 
If you use 2 different commands to enable and disable plugin you dont need args
How you use it?
sm_funmodenable 1

KlausLaw 05-16-2018 18:18

Re: Fun mod command error
 
Code:

RegAdminCmd("sm_funmode", Command_FunMode, ADMFLAG_KICK);
Code:

public Action Command_FunMode(int client, int args) {
        if (args < 1)
        {
                PrintToChat(client, "Usage: sm_funmode <1/0>.");
                return Plugin_Handled;
        }
        char sArg[3];
        GetCmdArg(1, sArg, sizeof(sArg));
        g_EnablePluginu = StringToInt(sArg) == 1;
       
        PrintToChatAll("Plugin %s!", g_EnablePluginu ? "enabled" : "disabled");
        return Plugin_Handled;
}

Enjoy.


All times are GMT -4. The time now is 12:47.

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