Raised This Month: $ Target: $400
 0% 

[SOLVED] Team checking & random transfer players from one team to another


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
groofshark
Member
Join Date: Jul 2013
Old 07-30-2013 , 08:10   [SOLVED] Team checking & random transfer players from one team to another
Reply With Quote #1

How can I check players in one team, e.g. terrorist team? I mean if players in terrorist team are less than or equal to 5 10 or 15 to perform a function. Also I would like to know how can I transfer randomly players from one team to another(T->CT)? When I understand how, also I would like to combine this 2 functions, e.g. if( terrorists < 5 ) ---> transfer 2 random players from T team in CT team.

Last edited by groofshark; 07-30-2013 at 10:07.
groofshark is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 08:19   Re: Team checking & random transfer players from one team to another
Reply With Quote #2

Use get_players to count how many people are on one team. Then you can also use get_players to determine who to send over since you will have a list of players on that team
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
groofshark
Member
Join Date: Jul 2013
Old 07-30-2013 , 08:45   Re: Team checking & random transfer players from one team to another
Reply With Quote #3

Hmm that?
PHP Code:
public func(id)
{
    new 
Players[32], Num
    get_players
(PlayersNum"ae""TERRORIST")
        
    if( 
Num <= 10 )
    {
        new 
id
        id 
Players[random(Num)]
         
        
// is this method right? for transfer 3ts in ct team?
        
cs_set_user_team(idCS_TEAM_CT)
        
cs_set_user_team(idCS_TEAM_CT)
        
cs_set_user_team(idCS_TEAM_CT)
    }


Last edited by groofshark; 07-30-2013 at 08:49.
groofshark is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 08:48   Re: Team checking & random transfer players from one team to another
Reply With Quote #4

Yes, except you are sending the same person to CT 3 times
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
groofshark
Member
Join Date: Jul 2013
Old 07-30-2013 , 09:37   Re: Team checking & random transfer players from one team to another
Reply With Quote #5

Hm, how can I send several terrorists in CT team?
groofshark is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 09:39   Re: Team checking & random transfer players from one team to another
Reply With Quote #6

cs_set_user_team(Players[random(Num)], CS_TEAM_CT)
cs_set_user_team(Players[random(Num)], CS_TEAM_CT)
cs_set_user_team(Players[random(Num)], CS_TEAM_CT)
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
groofshark
Member
Join Date: Jul 2013
Old 07-30-2013 , 09:42   Re: Team checking & random transfer players from one team to another
Reply With Quote #7

It is the same. I use:
Code:
id = Players[random(Num)]
and just replace
cs_set_user_team(Players[random(Num)], CS_TEAM_CT) with
cs_set_user_team(id, CS_TEAM_CT)

Last edited by groofshark; 07-30-2013 at 09:44.
groofshark is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 09:44   Re: Team checking & random transfer players from one team to another
Reply With Quote #8

It is not the same
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
groofshark
Member
Join Date: Jul 2013
Old 07-30-2013 , 09:48   Re: Team checking & random transfer players from one team to another
Reply With Quote #9

Okay, I want to ask something else. Can you tell me how is the correct if/if else form?

PHP Code:
if( Num <= )
{
    ...
}
else if( 
Num <=10 )
{
    ...
}
else if( 
Num <= 15 )
{
    ...

Is that right?
groofshark is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 09:53   Re: Team checking & random transfer players from one team to another
Reply With Quote #10

That will work, not sure why you don't just test it yourself
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 15:54.


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