Raised This Month: $ Target: $400
 0% 

Get a Random Dead Player Who is Not Admin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-02-2009 , 20:25   Re: Get a Random Dead Players
Reply With Quote #4

Retrieve a list of dead players ( using get_players() with "bh" as flags, or using a loop with for() + a check is_user_alive() ), then pick up a player randomly with random().

Basicaly :

Code:
new Players[32]; new Num; new RandomDeadPlayer ; get_players( Players, Num, "bh" ); RandomDeadPlayer = random( Num );

or

Code:
new MaxClients = get_maxplayers(); new RandomDeadPlayer ; new Num; for( new id = 1; id <= MaxClients; id++ ) {      if ( !is_user_alive( id ) ) { Num++; } } RandomDeadPlayer = random( Num );


[Edit] Ah. You say players not a player.
Arkshine 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 02:16.


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