Raised This Month: $51 Target: $400
 12% 

[HELP]Randome Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 03-23-2018 , 12:04   [HELP]Randome Player
Reply With Quote #1

Hello Gys,

How to can i randomly select 1 player for ct and 1 for ts and transfer other to spec ?? me too confused :/
soumyadip77 is offline
Send a message via Skype™ to soumyadip77
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 03-23-2018 , 16:05   Re: [HELP]Randome Player
Reply With Quote #2

get_players() random() set_user_team()
__________________
retired chump
DjSoftero is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-23-2018 , 17:20   Re: [HELP]Randome Player
Reply With Quote #3

Best answer would be search
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 03-23-2018 , 21:56   Re: [HELP]Randome Player
Reply With Quote #4

Me already searched bt i can get

PHP Code:
//------ Randome Captain------
public RandomCpt() 
{
    new 
players[32], pnumtempid;

    
cmdTransferAllInSpec();

    
get_players(playerspnum"ch");

    new 
specialCount
        
    
new random(pnum)
    while (
cs_get_user_team(players[z]) == CS_TEAM_SPECTATOR)
        
random(pnum)

    
rg_set_user_team(players[z], TEAM_TERRORISTMODEL_AUTOtrue)
    
gCptT players[z]
    
    new 
random(pnum)

    while ( (
== z) || cs_get_user_team(players[q]) == CS_TEAM_SPECTATOR)

        
random(pnum)
        
    
rg_set_user_team(players[q], TEAM_CTMODEL_AUTOtrue)

    
gCptCT players[q]

    
g_MatchInit true

    set_task
(5.0"LetsFirstChoosePlayers"gCptT)

    return;


soumyadip77 is offline
Send a message via Skype™ to soumyadip77
Argon Svng
Member
Join Date: Sep 2014
Old 03-24-2018 , 08:34   Re: [HELP]Randome Player
Reply With Quote #5

PHP Code:
public set_random()
{
    new 
ctrandomize(ct"CT");
    new 
trrandomize(tr"TERRORIST");
}

stock get_random(indexteam[]) 
{
    new 
players[32], num
    
get_players(playersnum"e"team); 
    
index players[random_num(0num 1)];
    
    if(
is_user_connected(index)) 
        
cs_set_user_team(indexCS_TEAM_SPECTATOR);

__________________
(Moroccan Coders) # I Love Morocco
Argon Svng is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 03-24-2018 , 10:08   Re: [HELP]Randome Player
Reply With Quote #6

Quote:
Originally Posted by Argon Svng View Post
PHP Code:
public set_random()
{
    new 
ctrandomize(ct"CT");
    new 
trrandomize(tr"TERRORIST");
}

stock get_random(indexteam[]) 
{
    new 
players[32], num
    
get_players(playersnum"e"team); 
    
index players[random_num(0num 1)];
    
    if(
is_user_connected(index)) 
        
cs_set_user_team(indexCS_TEAM_SPECTATOR);

This will be better:
PHP Code:
public set_random()
{
    new 
ct randomize("CT");
    new 
tr randomize("TERRORIST");
    
    
// now you know which CT and T were transfered to SPEC (if non-zero)
}

public 
randomize(team[]) 
{
    new 
players[32], numindex
    
get_players(playersnum"e"team); 
    
index players[random_num(0num 1)];
    
    if(
is_user_connected(index))
    {
        
cs_set_user_team(indexCS_TEAM_SPECTATOR);
        return 
index;
    }

    return 
0;

__________________
My English is A0

Last edited by E1_531G; 03-24-2018 at 10:11.
E1_531G 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 06:28.


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