Raised This Month: $ Target: $400
 0% 

Loop though all players and if is on 1 team do so other do that


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 06-23-2009 , 14:36   Loop though all players and if is on 1 team do so other do that
Reply With Quote #1

Hi im wondering whats the best loop if im going to loop all players check what team and then give them something depending on team?
Ive found some different loops but they dosent work/does it in another way.

Thanks in advanced
micke1101 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-23-2009 , 14:50   Re: Loop though all players and if is on 1 team do so other do that
Reply With Quote #2

Using get_players() :

Code:
new Players[ 32 ]; new Num; get_players( Players, Num, "ae", "TERRORIST" ); for ( new i; i < Num; i++ ) {     GiveMeSomething( Players[ i ] ); }

If you plan to use severals times the player's index, you should save it :

Code:
for ( new i; i < Num; i++ ) {     Player = Players[ i ];         GiveMeSomething( Player );     GiveMeSomething2( Player ); }


Looping through all players :

Code:
for ( new Player = 1; Player <= gMaxClients; Player++ ) {     if( is_user_alive( Player ) && cs_get_user_team( Player ) == CS_TEAM_T )     {         GiveMeSomething( Player );     } }
__________________
Arkshine is offline
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 06-23-2009 , 15:04   Re: Loop though all players and if is on 1 team do so other do that
Reply With Quote #3

Thank you
micke1101 is offline
Reply


Thread Tools
Display Modes

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 15:41.


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