Raised This Month: $ Target: $400
 0% 

Random player help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
purple nurple
Senior Member
Join Date: Jun 2007
Location: US Missouri
Old 10-25-2007 , 21:38   Random player help
Reply With Quote #1

All right I got it to choose a random person but how can i make it choose a team only like i only want cts to be random?? please help if you can
PHP Code:
public random_zombie()
{    
    if(
get_pcvar_num(zlevel) > 19)
    {
        new 
players[32], totalplayers
        get_players
(playerstotalplayers//any way here i can make it choose ct only?
        
        
        
if (!neme)
            
neme random_num(1totalplayers)
        
            
superplayer(neme)
            
    }
    

purple nurple is offline
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 10-25-2007 , 22:28   Re: Random player help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
Reply With Quote #2

Code:
new players[32], pnum for(new i;i<33;i++){         if(is_user_alive(i)){                    players[pnum]=i                    pnum++         } } new randomplayer = players[random_num(0,pnum)]

if you want only cts, add &&get_user_team(i)==2 after is_user_alive(i)
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-26-2007 , 04:34   Re: Random player help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
Reply With Quote #3

In your code :

get_players(players, totalplayers) => get_players(players, totalplayers, "e", "CT" )
__________________
Arkshine is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-26-2007 , 07:28   Re: Random player help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
Reply With Quote #4

This was already discussed:

http://forums.alliedmods.net/showthread.php?t=62060
__________________
M249-M4A1 is offline
Reply


Thread Tools
Display Modes

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


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