Raised This Month: $ Target: $400
 0% 

Only one random player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-25-2019 , 09:59   Only one random player
Reply With Quote #1

Merry Christmas!

I want to select only one random player

If i am TERO i want to select random player from CT
If i am CT i want to select random player from TERO

But also is wrong in this code becouse choose more players

Code:
public fwButtonUsed(button, test)
{
    if( g_bChallenging && is_user_alive ( test))
    {
        client_print( test, print_chat, "* Someone is already starting a challenge." );
        return HAM_HANDLED;
    }
    
    static iPlayers[32], iNum, id, iRandom[32], iPlayer, iRandomNum;
 
    get_players( iPlayers, iNum, "a");
 
    for ( new i = 0 ; i < iNum ; i++ )
    {
        id = iPlayers[i];
	
        if ( is_user_alive( test) && ( cs_get_user_team( test) == CS_TEAM_CT ) )
        {
            if ( cs_get_user_team(id) == CS_TEAM_T )
            {
                iRandom[ iRandomNum++ ] = id;
                iPlayer = iRandom[ random( iRandomNum ) ];
 
                g_bChallenging = true;

	       is_in_arena[test] = 1;
	       is_in_arena[iPlayer] = 1;
		
                client_print( test, print_chat, "* iPlayer Tero Hooked" );
            }
        }
        if ( is_user_alive( test) && ( cs_get_user_team( test) == CS_TEAM_T ) )
        {
            if ( cs_get_user_team(id) == CS_TEAM_CT )
            {
                iRandom[ iRandomNum++ ] = id;
                iPlayer = iRandom[ random( iRandomNum ) ];
 
                g_bChallenging = true;
		
	       is_in_arena[test] = 1;
	       is_in_arena[iPlayer] = 1;
	    
	       client_print( test, print_chat, "* iPlayer Counter Hooked" );
            }
        }
    }
    return HAM_HANDLED;
}

Last edited by Saint Sinner; 12-25-2019 at 10:00.
Saint Sinner 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:41.


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