AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   1 CT random (https://forums.alliedmods.net/showthread.php?t=163006)

RuleBreaker 07-25-2011 15:45

1 CT random
 
I want to have max 1 CT and I want to change CT every round with random T player, how?

fysiks 07-25-2011 16:29

Re: 1 CT random
 
I'm sure you could guess how to do the second part. On round end, pick a random player from Terrorists and set his team to CT and set the original CT to terrorist.

RuleBreaker 07-25-2011 16:31

Re: 1 CT random
 
I could use random(32) to get random id and set his team to CT, but how "lock" CT so others player can`t change team?

fysiks 07-25-2011 16:38

Re: 1 CT random
 
Quote:

Originally Posted by RuleBreaker (Post 1518361)
I could use random(32) to get random id

No. That is completely wrong.

You need to get a list of all the player id's that are on the one team then choose one of those randomly.

It sounds like you need to take one step at a time and not try to do so many things all at once.

RuleBreaker 07-25-2011 16:41

Re: 1 CT random
 
Example please? :)

fysiks 07-25-2011 16:42

Re: 1 CT random
 
There are examples on the forums.

RuleBreaker 07-25-2011 17:13

Re: 1 CT random
 
Comeone please give me it :(( I`m still learnign...

ANTICHRISTUS 07-25-2011 18:34

Re: 1 CT random
 
for example: search the words random player (in titles and posts).

Honors 07-25-2011 19:40

Re: 1 CT random
 
Code:
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 )

Untested.

fysiks 07-25-2011 19:43

Re: 1 CT random
 
@Honors, you should use random(num) since your way as the possibility of getting non-players.


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

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