Raised This Month: $ Target: $400
 0% 

Get a random player in each team.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-08-2014 , 11:46   Re: Get a random player in each team.
Reply With Quote #4

Quote:
Originally Posted by danonix View Post
It is called by a hltv event.

@11922911
Thanks, done

Code:
public Losuj_Kapitanow(id){
    if(playersInTeam(CS_TEAM_CT) >= 1 && playersInTeam(CS_TEAM_T) >= 1){
        new players[32],numCT, numTT
        if(!Kapitan_CTbool){
            get_players(players, numCT, "che", "CT")
            Kapitan_CT[id]=players[random(numCT)]
        }
        if(!Kapitan_TTbool){
            get_players(players, numTT, "che", "TERRORIST")
            Kapitan_TT[id]=players[random(numTT)]
        }
        CountDown()
        if(Czas_Odliczania == 0){
            if(is_user_connected(id) && get_user_team(id) == 1 && !Kapitan_TTbool){
                set_hudmessage(255, 0, 0, -1.0, 0.01)
                show_hudmessage(id, "Wybrano Kapitanow!^nKapitan TT: %s", Kapitan_TT[id])
                Kapitan_TTbool=true;
            }
            if(is_user_connected(id) && get_user_team(id) == 2 && !Kapitan_CTbool){
                set_hudmessage(0, 255, 0, -1.0, 0.01)
                show_hudmessage(id, "Wybrano Kapitanow!^nKapitan CT: %s", Kapitan_CT[id])
                Kapitan_CTbool=true;
            }
        }
    }
}




stock playersInTeam(CsTeams:team){
    new iIle = 0, i;
    for( i = 1 ; i <= get_maxplayers() ; i++ ){ // musi być <=
        if( !is_user_connected( i ) )
            continue;
        
        if(cs_get_user_team(i) == team)
            iIle++;
    }
    return iIle;
}
well there's your problem, hltv event doesen't pass any variable to the function
jimaway is offline
 



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 10:05.


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