AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if command is being executed (https://forums.alliedmods.net/showthread.php?t=134064)

Gadzislaw007 07-31-2010 11:13

Check if command is being executed
 
How can I check if is user executing a command?
For example i register:
PHP Code:

////globabl
new blabled[33]

////init
register_clcmd("blablabla""omgrotfl"

And then I bind '+blablabla' for 'v' button.

Now I want to check if v is pressed (is blablabla executing) and if it is then switch blabled[id] = 1, or if it is not then turn blabled[id] = 0.
So if user is holding V then 'blabled[id] = 1', if he releases v his 'blabled[id] = 0'.
How can I do that? V is just an example, I want to check is 'blablabla' working in current moment.

Bugsy 07-31-2010 11:37

Re: Check if command is being executed
 
PHP Code:

register_clcmd"+test" "Press" );
register_clcmd"-test" "Release" );

public 
Pressid )
{
    
client_printid print_chat "pressed" );
    
blabledid ] = 1;
}

public 
Releaseid )
{
    
client_printid print_chat "released" );
    
blabledid ] = 0;



Gadzislaw007 07-31-2010 14:59

Re: Check if command is being executed
 
Omg... I didn't think about such a simple way.
Thanks Bugsy! You saved my ass again.

meTaLiCroSS 08-01-2010 13:59

Re: Check if command is being executed
 
Quote:

Originally Posted by Gadzislaw007 (Post 1257487)
Omg... I didn't think about such a simple way.
Thanks Bugsy! You saved my ass again.

:crab::crab::3:3


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

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