Raised This Month: $ Target: $400
 0% 

Switching player's team. Will this work? Urgent Help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 07-20-2013 , 06:29   Switching player's team. Will this work? Urgent Help!
Reply With Quote #1

I know this is very awful code for team balancing but what do you think? Will this work?


PHP Code:
    new t_countct_countnumplayers[32], tempid;

    new 
ct_count    =    get_playersplayersnum"ae""CT" );  //Get ct count
    
new t_count    =    get_playersplayersnum"ae""T" ); //Get t count
    
if(t_count ct_count){
        
// T - CT
        
new tcount    =    t_count ct_count
        if(
tcount 1){
                        
//If there are more than 1 player which makes team unequal.
            // There are more Ts.then allowed!
            
while(tcount>1){
                new 
t_count    =    get_playersplayersnum"ae""T" );
                for(new 
0i<tcounti++){
                    
tempid    =    players[i];
                    
cs_set_user_team(tempidCS_TEAM_CT); //Change Player's team...
                    
i++;
                }
                
tcount++;
            }
        }
    } 
-TY!

Last edited by devWaleed; 07-20-2013 at 06:31.
devWaleed is offline
Send a message via Skype™ to devWaleed
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 07-20-2013 , 06:44   Re: Switching player's team. Will this work? Urgent Help!
Reply With Quote #2

I think it should be

PHP Code:
tcount--; //in while loop 
I have read it again, everything looks fine to me but It didn't work in my server. nothing happened. Tell me if there is anything wrong...
devWaleed is offline
Send a message via Skype™ to devWaleed
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-20-2013 , 07:58   Re: Switching player's team. Will this work? Urgent Help!
Reply With Quote #3

If it can help : http://forums.alliedmods.net/showthread.php?p=705142

About your code, get_players usage is wrong, get_players returns 1 and not players number that is hold in 'num' var.
Also, terrorists team name is "TERRORIST"

PHP Code:
    new ct_count    =    get_playersplayersnum"ae""CT" );  //Get ct count
    
new t_count    =    get_playersplayersnum"ae""T" ); //Get t count 
->
PHP Code:
    get_playersplayersct_count"ae""CT" );  //Get ct count
    
get_playersplayerst_count"ae""TERRORIST" ); //Get t count 
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-20-2013 at 08:00.
ConnorMcLeod is offline
devWaleed
Member
Join Date: Apr 2013
Location: Karachi, Pakistan
Old 07-20-2013 , 11:39   Re: Switching player's team. Will this work? Urgent Help!
Reply With Quote #4

Thank for reply. I changed my approached. But I am getting "Tag mismatch error" on this line:

PHP Code:
   ePlayer  =  floatround((num num2)/2floatround_ceil); 
devWaleed is offline
Send a message via Skype™ to devWaleed
Old 07-20-2013, 14:28
devWaleed
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
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 06:27.


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