AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   as used cs_get_user_team??? (https://forums.alliedmods.net/showthread.php?t=85739)

larito 02-15-2009 09:20

as used cs_get_user_team???
 
I'm working in a scripting, make when start round say hudmessage if team Human "umbrella needs your help" and if team T "destroy umbrella". But I don not as differentiate the team, I will do so to speak for all.Why would I want to learn how to read it in one team and another team something else


sorry for my inglish
I use traductor

anakin_cstrike 02-15-2009 12:49

Re: as used cs_get_user_team???
 
Using a for loop and maxplayers / get_players (not indicated)

Starsailor 02-15-2009 14:04

Re: as used cs_get_user_team???
 
PHP Code:

new players[32], pnumid

get_players
(playerspnum);
        
        for( new 
i=0i<pnumi++ ){
            
id   players[i];

if(
get_user_team(id) == 1){
 
//code team TT   
            
}

else if(
get_user_team(id) == 2){
    
//code team CT
            
}
   } 


xPaw 02-15-2009 14:12

Re: as used cs_get_user_team???
 
PHP Code:

new players[32], pnumidiTeam

get_players
(playerspnum);

for( new 
1pnumi++ ) {
    
id players];
    
    
iTeam get_user_teamid );
    
    if( 
iTeam == ) {
        
// Terrorist team..
    
}
    else if( 
iTeam == ) {
        
// CT Team..
    
}


get team just once, insead of getting it twice.

Arkshine 02-15-2009 14:18

Re: as used cs_get_user_team???
 
Code:
for( new i; i < pnum; i++ ) {     switch ( get_user_team( players[ i ] ) )     {         case 1 : // Terrorist team..         case 2 : // CT Team..     } }

xPaw 02-15-2009 14:30

Re: as used cs_get_user_team???
 
thats better :)

anakin_cstrike 02-15-2009 16:10

Re: as used cs_get_user_team???
 
Neah ^^
Code:
for( new i; i < pnum; i++ ) {     switch ( get_user_team( players[ i ] ) )     {         case 1 : // Terrorist team..         case 2 : // CT Team...         default: continue; // skip spectators     } }

Arkshine 02-15-2009 16:43

Re: as used cs_get_user_team???
 
Pointless, there is no code after the switch, so if it's not 1 or 2, it will continue.

larito 02-15-2009 19:42

Re: as used cs_get_user_team???
 
Quote:

Originally Posted by Starsailor (Post 762137)
PHP Code:

new players[32], pnumid

get_players
(playerspnum);
        
        for( new 
i=0i<pnumi++ ){
            
id   players[i];

if(
get_user_team(id) == 1){
 
//code team TT   
            
}

else if(
get_user_team(id) == 2){
    
//code team CT
            
}
   } 


+karma for you worked perfect thanks!

hleV 02-15-2009 19:45

Re: as used cs_get_user_team???
 
Quote:

Originally Posted by larito (Post 762305)
+karma for you worked perfect thanks!

Why did you choose the worst code in the thread?


All times are GMT -4. The time now is 17:05.

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