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
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-26-2017 , 14:45   Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Reply With Quote #9

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;

I'd like to ask, does get_user_team consider Team_Unassigned as 0, Team_T as 1 ... ?
__________________
edon1337 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 21:03.


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