Raised This Month: $ Target: $400
 0% 

Solved Questions about optimization and cs_set_user_team()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
frio
Junior Member
Join Date: May 2020
Old 06-02-2020 , 22:27   Re: Questions about optimization and cs_set_user_team()
Reply With Quote #1

Thank you both for your answers! Bugsy's code was very enlightening.

There was also some good info on programming habits that Arukari linked that I will be reading later.

One thing: I probably should have been more specific, but the following code will not increase "count[team]" if the player is already part of the randomly chosen team. This should not be the case, it should increase regardless. But I can fix that myself.

Quote:
Originally Posted by +ARUKARI- View Post
PHP Code:
    new const teams[] = {CS_TEAM_CTCS_TEAM_T};
    new 
count[2];
    new 
id;
    for (
0numberOfPlayersi++) 
    {
        
id players[i];
        
team random_num(01)
        if (
cs_get_user_team(id) != teams[team])
        {
            if (
count[team] < maxPlayersPerTeam)
            {
                
cs_set_user_team(idteams[team])
                
count[team]++
            }
        }
    } 
Again, thanks for the speedy replies!

Thread marked as solved.
frio 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 16:56.


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