AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Two random players of each team (https://forums.alliedmods.net/showthread.php?t=184637)

Backstabnoob 05-07-2012 08:47

Two random players of each team
 
What's the most efficient method of finding two random players of each team?

Exolent[jNr] 05-07-2012 09:39

Re: Two random players of each team
 
Get all players of team 1.
Store random player id of team 1 into variable1.
Get all players of team 2.
Store random player id of team 2 into variable2.

rak 05-07-2012 10:47

Re: Two random players of each team
 
example

PHP Code:

#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"

new id_ctid_tt
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""RoundStart""a""1=0""2=0")
}

public 
RoundStart() {
    new 
players[32], pnum
    
    get_players
(playerspnum"ae""CT")
    
    
id_ct players[random(pnum)]
    
    
get_players(playerspnum"ae""TERRORIST")
    
    
id_tt players[random(pnum)]
    
    if(
id_ct && id_tt) {
        
set_user_health(id_ct200)
        
SendMsj(id_ct)
        
        
set_user_health(id_tt200)
        
SendMsj(id_tt)
    }
}

public 
SendMsj(id)
    
client_print(idprint_chat"[AMX] You won 200 of life"


Backstabnoob 05-07-2012 11:11

Re: Two random players of each team
 
Quote:

Originally Posted by Backstabnoob (Post 1704114)
What's the most efficient method of finding two random players of each team?


Exolent[jNr] 05-07-2012 11:12

Re: Two random players of each team
 
Oh, two of each? Check out this thread.

Backstabnoob 05-07-2012 13:30

Re: Two random players of each team
 
Very helpful thread, thanks for linking it.


All times are GMT -4. The time now is 00:27.

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