Raised This Month: $51 Target: $400
 12% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-26-2017 , 15:31   Re: [Snippet request]Best way to randomly choose a random player from the enemy team?
Reply With Quote #11

Quote:
Originally Posted by OciXCrom View Post
enum numerates the variables starting from 0 if no other default value is assigned.
Thanks.
__________________
edon1337 is offline
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 #12

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
Reply



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 12:24.


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