AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved RegConsoleCmd function (https://forums.alliedmods.net/showthread.php?t=290323)

Benoist3012 11-10-2016 15:59

RegConsoleCmd function
 
Hello everyone!

I made a small plugin, and I have a small problem with RegConsoleCmd

Code:
#include <sourcemod> #include <sdktools> #include <tf2> #include <tf2_stocks> #include <sdkhooks> bool bMimic = false; public void OnPluginStar() {     RegConsoleCmd("sm_toggle_mimic", Command_Mimic); } public Action Command_Mimic(int iClient, int iArgs) {     if (bMimic)         bMimic = false;     else         bMimic = true;     return Plugin_Handled; }

The client/server console, always says unknown command, I renamed the command, made a new plugin, upgraded sourcemod downgraded sourcemod, nothing, any help?

Ps: the variable (bMimic) is never changed when I use the command.

Soluce:Welp I feel dumb found my mistake, I wrote OnPluginStar I should have written OnPluginStart xd
I should reread my work slowly next time

Michael Shoe Maker 11-10-2016 18:08

Re: RegConsoleCmd function
 
Also:

PHP Code:

public Action Command_Mimic(int iClientint iArgs)
{
    
bMimic = !bMimic;

    return 
Plugin_Handled;



Benoist3012 11-10-2016 18:22

Re: RegConsoleCmd function
 
Quote:

Originally Posted by Michael Shoe Maker (Post 2469255)
Also:

PHP Code:

public Action Command_Mimic(int iClientint iArgs)
{
    
bMimic = !bMimic;

    return 
Plugin_Handled;



Yeah I was a bit paranoid I used !bMimic at first but I thought that was my problem :)


All times are GMT -4. The time now is 22:45.

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