Raised This Month: $ Target: $400
 0% 

Last player replace (on disconnect) without round end?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LNATIC
Junior Member
Join Date: Sep 2012
Location: cstrike.h
Old 07-23-2014 , 21:01   Last player replace (on disconnect) without round end?
Reply With Quote #1

Hi all, as the title says.. how can I do this?

I have this code, but it does't work (the round ends anyway):
PHP Code:
public client_disconnect(id)  if(is_user_alive(id))     check_round(); // call check round function

check_round(){
    if(
g_bRoundEnd) return; // round ending bool (false on round start, true on round end)
    
static szName[32], randomplayerrandomplayer fnGetRandomPlayer();
    if(
fnGetTeamPlayers(1) == 1){
        
cs_set_user_team(randomplayerCS_TEAM_T); // change team
        
get_user_name(randomplayerszName31 ); // get the name
        
client_print(0,print_chat,"The last TT left, %s is the new TT",szName); // advertise which player
        
ExecuteHamB(Ham_CS_RoundRespawnrandomplayer); // respawn the new last player
    
}
}
fnGetTeamPlayers(team) {
    static 
iiPls;
    for (
0g_iMaxpli++){
        if (
is_user_connected(i)){
            switch(
team){
                case 
1:if (cs_get_user_team(i) == CS_TEAM_T)    iPls++;
                case 
2:if (cs_get_user_team(i) == CS_TEAM_CT)    iPls++;
            }
        }
    }
    return 
iPls;
}
fnGetRandomPlayer(){
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"h")
    if( 
iNum <= )    return iPlayers[0]
    new 
iRandomNum random(iNum)
    new 
iRandomPlayer iPlayersiRandomNum ]
    if( 
iRandomPlayer == g_iLastChoosenPlayer ){
        
iPlayersiRandomNum ] = iPlayers[ --iNum ]
        
iRandomPlayer iPlayersrandom(iNum) ]
    }
    
g_iLastChoosenPlayer  iRandomPlayer
    
return iRandomPlayer

LNATIC is offline
 


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 13:15.


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