Raised This Month: $ Target: $400
 0% 

Random player/s.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-09-2009 , 15:17   Re: Random player/s.
Reply With Quote #9

Quote:
Originally Posted by padilha007 View Post
PHP Code:
#include <amxmodx>
#include <fakemeta>
 
public plugin_init()
{
    
register_plugin("Random Player""0.1""padilha007")
    
register_logevent("random_player"2"1=Round_Start")
}
 
public 
random_player()
{
    new 
players[32], totalplayersrandplayer;
    
get_players(playerstotalplayers)
 
    if (!
randplayer)
        
randplayer random_num(1totalplayers)
 
    if(!
is_user_connected(randplayer) || !is_user_alive(randplayer))
    {
        
set_task(0.1"random_player")
        return 
PLUGIN_HANDLED
     
}
 
 
    
// You stuff with randplayer
    // index = randplayer

Quote:
Originally Posted by Exolent[jNr] View Post
padilha's way is only good if you want 1 player.
If you want random players, see the tutorial that arkshine gave.
Good? No it isn't. It's not efficient and can take even 3 secs. Also the connected check isn't needed. And it's getting maxplayers many times even it isn't needed.
PHP Code:
new players[32], totalplayersrandplayer;
get_players(playerstotalplayers"a");
randplayer random_num(1totalplayers);
//player index is randplayer 

Last edited by SnoW; 05-09-2009 at 15:21.
SnoW is offline
Send a message via MSN to SnoW
 



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 23:09.


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