AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Restrict function... (https://forums.alliedmods.net/showthread.php?t=11678)

LynX 03-26-2005 03:35

Restrict function...
 
How the heck I can restrict some function? Let's say, mine function called "stickgun" is active. If it is active, the plugin restricts to use commands like "Duck" , "menu", etc... But if I call another function restriction will dissapear. So, how can I restrict functions if mine is active?

XxAvalanchexX 03-26-2005 04:05

If you are using register_clcmd or register_concmd and returning PLUGIN_HANDLED, make sure your plugin is at the top of the list (or above any other plugins that may be catching the same command).

LynX 03-26-2005 04:20

Ermm, I doubt mine plugin will be at top of the list... So is there any other way?

Jinto 03-26-2005 09:04

If you are sure no other plugins are intercepting that command then it can be anywhere. But if you are not sure just in a readme file or something warn them if they do not place it as the first plugin problems can arise.

Anyway I use the same method for blocking certain actions. I just supercede the command if I'm doing action a and don't want action b called.

LynX 03-26-2005 11:11

Erm, can some1 show me a code snippet?

Jinto 03-27-2005 02:30

This is how I block the powerup in esf if I don't want them using it. ( I'm using metamod but here is an amxx snippet ).

Code:

public plugin_init( ) {
    register_clcmd( "+powerup", "powerup" );
    register_clcmd( "-powerup", "powerup" );
}

public powerup( id, level, cid ) {
    if( ACTIONA ) {
          return PLUGIN_HANDLED;
    }
   
    return PLUGIN_CONTINUE;
}



All times are GMT -4. The time now is 09:59.

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