Raised This Month: $ Target: $400
 0% 

[code] infinity loop


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
JusTGo
Veteran Member
Join Date: Mar 2013
Old 12-28-2015 , 04:15   [code] infinity loop
Reply With Quote #1

PHP Code:
GetRandomPlayer()
{
    static 
iPlayerBitsi
    
    
//Make a bitsum of connected player indexes. 
    //You can add additional checks here (bot,team,admin, etc).
    
for ( <= g_iMaxPlayers i++ )
        if ( 
IsSetBit(g_iBitUserAlive) && g_iUserTeam[i] == )
            
iPlayerBits |= ( << ( ) );
    
    
//No players are connected.
    
if ( !iPlayerBits )
        return 
0;
    
    
//Keep looping until there is no players that haven't been selected.
    
while( iPlayerBits != g_Selected )
    {
        
//Get random player id
        
= ( random_numg_iMaxPlayers ) - );
        
        
//If player is connected and has not yet been selected
        
if ( ( iPlayerBits & ( << ) ) && !( g_Selected & ( << ) ) )
        {
            
//Set bit in g_Selected bit-field so they will be ignored on the next call
            
g_Selected |= ( << );
            return ( 
);
        }
    }
    
    
//All players have already been selected.
    
g_Selected 0;
    return 
GetRandomPlayer()

some times randomly this code make infinity loop i took it from here https://forums.alliedmods.net/showth...634#post829634 i m trying to make it automatically reset selected players when all players have been selected.
__________________
JusTGo 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 17:57.


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