Raised This Month: $ Target: $400
 0% 

Random player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-03-2011 , 22:50   Re: Random player
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
Use a switch for get_user_team(). Also, no reason to use continue in code so small, it just makes it harder to read.
Yes Sir ;)

PHP Code:
getRandPlayer()
{
    new 
players32 ], playernumpList33 ], count;
    
get_playersplayersnum"a" );
    for( new 
num ++ )
    {
        
player players];
        if( 
get_user_teamplayer ) == || get_user_teamplayer ) == )
        {
            
pListcount ] = player;
            
count ++;
        }
    }
    
    return 
pListrandomcount ) ];

But to use a switch statement in there, wouldn't that make you have the result code would be written there twice? Or can you actually do
PHP Code:
case 2:
{
    
//

...?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 08-03-2011 at 22:52.
hornet 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 03:28.


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