Raised This Month: $ Target: $400
 0% 

How to get 1 player from X


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-04-2010 , 13:55   Re: How to get 1 player from X
Reply With Quote #1

PHP Code:
RandomPlayer()
{
    new 
players[32], pnum;
    
get_players(playerspnum);
    
    return 
pnum players[random(pnum)] : 0;

__________________
Bugsy is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-04-2010 , 14:59   Re: How to get 1 player from X
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
PHP Code:
RandomPlayer()
{
    new 
players[32], pnum;
    
get_players(playerspnum);
    
    return 
pnum players[random(pnum)] : 0;

Hmm, if pnum is 0, my code will return 0 to, not?
__________________
I am out of order!
grimvh2 is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-04-2010 , 15:34   Re: How to get 1 player from X
Reply With Quote #3

Quote:
Originally Posted by grimvh2 View Post
Hmm, if pnum is 0, my code will return 0 to, not?
If pnum is 0, then that means there are no players and 0 will be returned, yes.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-04-2010 , 16:17   Re: How to get 1 player from X
Reply With Quote #4

Quote:
Originally Posted by wrecked_ View Post
If pnum is 0, then that means there are no players and 0 will be returned, yes.
Then bugsy failed to correct me :p ( my opinion )
__________________
I am out of order!
grimvh2 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 03:56.


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