Raised This Month: $ Target: $400
 0% 

[SOLVED]Best way to randomly choose a random player from the enemy team?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Infractem
Member
Join Date: Dec 2016
Old 01-29-2017 , 02:13   Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
Best to avoid using magic numbers. I'd do the below or use cstrike for CS_TEAM_T.
PHP Code:
enum Teams
{
    
Team_Unassigned,
    
Team_T,
    
Team_CT,
    
Team_Spectator
}

get_random_enemyid )
{
    new 
iPlayers[32], iPnum
    get_players
(iPlayersiPnum"ae"Teams:get_user_teamid ) == Team_T "CT" "TERRORIST")
    
    return 
iPnum iPlayersrandomiPnum ) ] : 0;

Thanks!
Infractem 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 20:42.


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