Raised This Month: $51 Target: $400
 12% 

Creating @all, @red and @blu agument suppoer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Semas
Junior Member
Join Date: Jul 2008
Old 08-08-2010 , 10:00   Creating @all, @red and @blu agument suppoer
Reply With Quote #1

hello, i was wondering what would be the best way to create support for @all @red and @blu argument for admin commands.

Thanks you.
Semas is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 08-08-2010 , 10:25   Re: Creating @all, @red and @blu agument suppoer
Reply With Quote #2

use ProcessTargetString

eg
PHP Code:
if(args == 1) {
    
decl String:strTarget[32]; GetCmdArg(1strTargetsizeof(strTarget));

    
// Process the targets
    
decl String:strTargetName[MAX_TARGET_LENGTH];
    
decl TargetList[MAXPLAYERS], TargetCount;
    
decl bool:TargetTranslate;

    if ((
TargetCount ProcessTargetString(strTargetclientTargetListMAXPLAYERSCOMMAND_FILTER_CONNECTED,
                                           
strTargetNamesizeof(strTargetName), TargetTranslate)) <= 0)
    {
        
ReplyToTargetError(clientTargetCount);
        return 
Plugin_Handled;
    }

    
// Apply to all targets
    
for (new 0TargetCounti++)
    {
        new 
iClient TargetList[i];
        if (
IsClientInGame(iClient) && !IsFakeClient(iClient)) {
        }
    }

__________________
einmal mit profis arbeiten. einmal.
Thrawn2 is offline
Swixel
Senior Member
Join Date: Jul 2010
Location: Sydney, Australia
Old 08-09-2010 , 00:17   Re: Creating @all, @red and @blu agument suppoer
Reply With Quote #3

If you're finding @blu doesn't work, it's because it's @blue (note the e). I made the same mistake. (By the by, it's in extension.cpp in the tf2 extension directory if you're wondering where it's defined -- but that's only really useful if you're compiling your own sourcemod install for whatever reason).

I could be wrong in doing so, but I include tf2 in my scripts to make sure it's there (I believe the extension needs to be loaded to get the selectors); though @all should be a generic one (but @red and @blue are within extension.cpp within the tf2 extension).
Swixel is offline
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 05:15.


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