Raised This Month: $ Target: $400
 0% 

1 CT random


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Honors
Member
Join Date: Jul 2011
Old 07-26-2011 , 05:41   Re: 1 CT random
Reply With Quote #1

@fysiks : Edited.
Honors is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 07-25-2011 , 20:38   Re: 1 CT random
Reply With Quote #2

I won`t work, what if server isn`t full and I get 31?
RuleBreaker is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 07-25-2011 , 22:29   Re: 1 CT random
Reply With Quote #3

Code:
stock get_random_player( ) {     /*     * a - Don't return dead players     * b - Don't return alive players     * c - Skip bots     * d - Skip real players     * e - Match with passed team     * f - Match with part of name     * g - Ignore case sensitivity     * h - Skip HLTV     */         new iPlayers[32], iTotal;     get_players( iPlayers, iTotal, "ah" );         if( !iTotal ) return 0;         return iPlayers[random( iTotal )]; }

Code:
new id = get_random_player( ); if( cs_get_user_team( id ) == CS_TEAM_T ) {     cs_set_user_team( id, CS_TEAM_CT ); }
__________________
Hi.

Last edited by Kreation; 07-25-2011 at 22:30. Reason: fucking pawn tags..
Kreation is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 07-26-2011 , 05:27   Re: 1 CT random
Reply With Quote #4

i tried it with logevent_round_end and it doesn`t work
RuleBreaker is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 07-26-2011 , 06:18   Re: 1 CT random
Reply With Quote #5

@honors i still get more than 1 CT
Quote:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Stefan"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)

// Add your code here...
}
public fwHamPlayerSpawnPost(id) {
if( cs_get_user_team( id ) == CS_TEAM_CT )
{
cs_set_user_team( id , CS_TEAM_T )
}
new players[ 32 ] , num
get_players( players , num , "che" , "TERRORIST" )

new rand = random( num )
cs_set_user_team( players[ rand ] , CS_TEAM_CT )
}
RuleBreaker is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-26-2011 , 16:01   Re: 1 CT random
Reply With Quote #6

Put everything inside the if( cs_get_user_team( id ) == CS_TEAM_CT ) statement.

I think I would probably use Ham_Killed because then everything is done before the round starts.
__________________
fysiks is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 07-27-2011 , 17:08   Re: 1 CT random
Reply With Quote #7

@Kreation
thanks it`s working but here`s problem
because you used "id" for random number how to keep 1 player in CT? Because transfered player isn`t going back to T he stays in CT but I need only 1 player every round
RuleBreaker is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 07-27-2011 , 19:36   Re: 1 CT random
Reply With Quote #8

Quote:
Originally Posted by RuleBreaker View Post
@Kreation
thanks it`s working but here`s problem
because you used "id" for random number how to keep 1 player in CT? Because transfered player isn`t going back to T he stays in CT but I need only 1 player every round
Store the id of the random player and at the end of the round, put him back T.
__________________
Hi.
Kreation is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 07-28-2011 , 04:27   Re: 1 CT random
Reply With Quote #9

How?
RuleBreaker is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-28-2011 , 05:11   Re: 1 CT random
Reply With Quote #10

Quote:
Originally Posted by RuleBreaker View Post
How?
You make a variable and store the id of the player in it. Then, set that player's team to the appropriate team after choosing your random player.
__________________
fysiks is offline
Reply



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 00:46.


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