Raised This Month: $ Target: $400
 0% 

Get random player?


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-20-2010 , 11:46   Get random player?
#1

Hi.
I have a bool:
new bool: g_isVip[33]

And i whant to set "true" to only 1 random player when the round starts
What code should i use?
eNz0 is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-20-2010 , 12:24   Re: Get random player?
#2

Use event HLTV,loop all players and use random_num

Last edited by #8 SickneSS; 05-20-2010 at 12:39.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-20-2010 , 12:32   Re: Get random player?
#3

if i use random num, will all players get different numbers?

Last edited by eNz0; 05-20-2010 at 12:39.
eNz0 is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-20-2010 , 12:41   Re: Get random player?
#4

yes,i think,i never used a boolean in random_num,but i think thats works

btw do not use get_maxplayers or get_playersnum,use get_players
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-20-2010 , 12:53   Re: Get random player?
#5

Tag mismatch...
eNz0 is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-20-2010 , 12:56   Re: Get random player?
#6

show line
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-20-2010 , 12:59   Re: Get random player?
#7

g_isVip[id] = random_num(1, 32)

p.s I havent used get_players yet.
eNz0 is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-20-2010 , 12:59   Re: Get random player?
#8

0,32 if not u should use the array you assigned in get_players(HERE,);
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-20-2010 , 13:05   Re: Get random player?
#9

Spacing doesnt matter, numbers too.
Tag mismatch
eNz0 is offline
Hx7r
Member
Join Date: Mar 2009
Old 05-20-2010 , 13:08   Re: Get random player?
#10

try


Code:
new g_MaxPlayers ; new bool:g_isVip[33]; public plugin_init() {     register_logevent("eRound_Start", 2, "1=Round_Start");     g_MaxPlayers = get_maxplayers(); } public eRound_Start(){     for(new i = 1; i <= g_MaxPlayers; i++)     g_isVip[i] = false;         g_isVip[random_num( 1, g_MaxPlayers)] = true; }

Last edited by Hx7r; 05-20-2010 at 13:51.
Hx7r is offline
Closed Thread


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 03:39.


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