Raised This Month: $ Target: $400
 0% 

this is working or have another best method?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-21-2011 , 11:12   this is working or have another best method?
Reply With Quote #1

this is working or have another best method?

PHP Code:
public SwapTeams()
{
    for(new 
1<= g_iMaxPlayersi++)
    {
        if(
is_user_connected(i))
        {
            switch(
cs_get_user_team(i))
            {
                case 
CS_TEAM_T:
                {
                    new 
MODEL[4] = {1,5,6,7// CTs const models (See cstrike.inc)
                    
cs_set_user_team(i,CS_TEAM_CT,random_num(MODEL))
                }    
                case 
CS_TEAM_CT:
                {
                    new 
MODEL[4] = {2,3,4,8// TRs const models (See cstrike.inc)
                    
cs_set_user_team(i,CS_TEAM_T,random_num(MODEL))
                }
            }
        }
    }

Edit: Is a random_num
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 07-21-2011 at 11:17. Reason: Ops
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
jim_yang
Veteran Member
Join Date: Aug 2006
Old 07-21-2011 , 11:16   Re: this is working or have another best method?
Reply With Quote #2

if server is 32 ppl and it's full. this method will crash your server cause it sent too many messages at one moment. better add a delay.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-21-2011 , 13:07   Re: this is working or have another best method?
Reply With Quote #3

PHP Code:
new MODEL[4] = {/*values*/}
cs_set_user_team(i,CS_TEAM_/*T or CT*/,random_num(MODEL)) 
You are selecting the model incorrectly.
You have to get a random index of the array:

PHP Code:
new MODEL[4] = {/*values*/}
cs_set_user_team(i,CS_TEAM_/*T or CT*/,MODEL[random(sizeof(MODEL))]) 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-22-2011 , 10:00   Re: this is working or have another best method?
Reply With Quote #4

thnks
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 01:08.


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