Raised This Month: $ Target: $400
 0% 

@TEAM


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-05-2005 , 12:14   Re: @TEAM
Reply With Quote #4

Quote:
Originally Posted by v3x
Umm, why won't this work?
Code:
// .. new arg[32] new players[32] new player,num,i read_argv(1,arg,31) if(equali(arg[0],"@")) {     get_players(players,num,"bce",arg[1])     if(!num) {             console_print(id,"[AMXX] No players on such team!")             return PLUGIN_HANDLED     }     for(i=0;i<num;i++) {         player = players[i]         // Do something with player =)     } } // ..
The way that works is by manually supplying the Full Team Name, which is: @CT & @TERRORIST to the command in console..

but in the console, I find that a bit tedious to say the least, and it is much nicer when you can just type @CT & @T

And let your code add the Full Name for Terrorist itself..

My suggestion:
Code:
new iPlayers[32], iNum, player new szArg[32] read_argv( 1, szArg, 31 ) if( szArg[0] == '@' ) // Group of Players.. {     if( equali(szArg[1], "T") || equali(szArg[1], "TERRORIST") )         get_players( iPlayers, iNum, "e", "TERRORIST" )     else if( equali(szArg[1], "C") || equali(szArg[1], "CT") )         get_players( iPlayers, iNum, "e", "CT" )     else if( equali(szArg[1], "A") || equali(szArg[1], "ALL") )         get_players( iPlayers, iNum)     if(!iNum) {         console_print(id,"[AMXX] No players on such team!")         return PLUGIN_HANDLED     }     for( i=0; i<iNum; i++ )     {         player = iPlayers[i]         // Do something with player =)     } }else if( szArg[0] == '*' ) // ALL Again, but with wildcard * {     get_players( iPlayers, iNum)     if(!iNum) {         console_print(id,"[AMXX] No players found!")         return PLUGIN_HANDLED     }     for( i=0; i<iNum; i++ )     {         player = iPlayers[i]         // Do something with player =)     } }else // Individual player {     player  = cmd_target( id, szArg[0], 1 + 2 + 4 + 8 ) // Remove bits you dont need..     if( !player  ) return PLUGIN_HANDLED         // Do something with player =) }

Feel free to use such a method in your plugins!! Makes it easier in console, you could type (for example):

amx_command @A
amx_command *
amx_command @T
amx_command @CT
amx_command xeroblood
amx_command #1

Stuff like that.. I hope that helps!
xeroblood is offline
Send a message via MSN to xeroblood
 



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 16:36.


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