Raised This Month: $ Target: $400
 0% 

Would this be equally fast?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
01101101
BANNED
Join Date: Nov 2009
Location: 9`su 09`n0n7e`r0f76a
Old 01-11-2010 , 01:35   Would this be equally fast?
Reply With Quote #1

A guy asked me for a code that chooses 2 random players and send them to TT/CT. I gave him 2 codes, though I wonder which is better.

PHP Code:
new plr1plr2
start
:
plr1 random_num(1g_maxplayers)
if(!
is_user_connected(plr1)) goto start
cs_set_user_team
(plr1CS_TEAM_CT)
second:
plr2 random_num(1g_maxplayers)
if(
plr2 == plr1 || !is_user_connected(plr2)) goto second
cs_set_user_team
(plr2CS_TEAM_TT
PHP Code:
new randomrandom2
do { random random_num(1g_maxplayers) } while(!is_user_connected(random))
cs_set_user_team(randomCS_TEAM_CT)
do { 
random2 random_num(1g_maxplayers) } while(random == random2 || !is_user_connected(random2)) 
cs_set_user_team(random2CS_TEAM_TT
IMO, they are the same, I mean, doesn't do-while work in that way?
PD: Pasta code

Last edited by 01101101; 01-11-2010 at 01:38.
01101101 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 03:45.


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