RandomPlayer
#1

Код:
		if(ConnectedPlayers() >= 2)
		{
			if(GetPlayersInTeam(TEAM_ZOMBIE) == 0)
			{
			    new p = RandomPlayer();
Hello i have an Question how to set when 10 or 20 Players online, more Players randomly to Zombie Team? Because it set now everytime only 1 random Zombie.
Reply
#2

Show the full code and try it put it this way.

pawn Код:
if(GetPlayersInTeam(TEAM_ZOMBIE) <= GetPlayersInTeam(TEAM_NORMAL))
//It's just saying that if the team zombie has less or equal players than the default team, it should put players on the zombie team.
Reply
#3

Put it then random Amount of Players? Like 8 Humans. 2 Zombies?
Reply
#4

~fixed~
Reply
#5

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Full Code:

Код:
		if(ConnectedPlayers() >= 2)
		{
			if(GetPlayersInTeam(TEAM_ZOMBIE) == 0)
			{

			    new p = RandomPlayer();
		    	TogglePlayerControllable(p,0);
		   	 	ResetPlayerWeaponStats(p);
		   	 	PlayerTeam[p] = TEAM_ZOMBIE;
		   	 	SetPlayerSkin(p,134);
			    SetPlayerTeam(p,TEAM_ZOMBIE);
			    SetPlayerColor(p,0x946D18FF);
                SetPlayerHealth(p,150.0);
			    GivePlayerWeaponEx(p,4,1);
			    TogglePlayerControllable(p,1);
			    SendClientMessage(p,COLOR_REDORANGE,"«| You are a Zombie. |»");
			    format(str,144,"«| %s has been randomly set to Zombie. |»",PlayerName[p]);
			    SendClientMessageToAll(COLOR_RED,str);
			}
			else if(GetPlayersInTeam(TEAM_HUMAN) == 0)
			{
			    new p = RandomPlayer();
			    TogglePlayerControllable(p,0);
			    ResetPlayerWeaponStats(p);
		   	 	PlayerTeam[p] = TEAM_HUMAN;
		   	 	SetPlayerSkin(p,285);
		   	 	SetPlayerTeam(p,TEAM_HUMAN);
			    SetPlayerColor(p,0x349532FF);
			    SetPlayerHealth(p,100.0);
     			GivePlayerWeaponEx(p,23,9999);
     			GivePlayerWeaponEx(p,25,9999);
     			GivePlayerWeaponEx(p,29,9999);
     			GivePlayerWeaponEx(p,31,9999);
     			GivePlayerWeaponEx(p,17,5);
			    TogglePlayerControllable(p,1);
			    SendClientMessage(p,COLOR_YELLOW,"«| You are a Human. |»");
			    format(str,144,"«| %s has been randomly set to Human. |»",PlayerName[p]);
			    SendClientMessageToAll(COLOR_CYAN,str);
The reason why it only puts 1 player on the zombie team is because you are comparing it with "0". So instead use < or > sign to distinguish the difference between them and put them on the proper team.
Reply
#6

Would you make me this? It were nice, because i dont know how to make it balanced.
Reply
#7

That work not:

Код:
			if(GetPlayersInTeam(TEAM_ZOMBIE) == <>)
Or must i difference that with every Playeramount like 4 Players 2 Zombies and 6 Players 3 Zombies?

Or that?

Код:
			if(GetPlayersInTeam(TEAM_ZOMBIE) == 2)
Reply
#8

I have tried it now so:

Код:
			if(GetPlayersInTeam(TEAM_ZOMBIE) == 1)
Will it work? So that when 4 Players connecting, 2 Players are randomly setted to Zombie?
Reply
#9

Check this article out.

https://sampwiki.blast.hk/wiki/Control_Structures
Reply
#10

But what would happen when i use:

Код:
		if(ConnectedPlayers() >= 2)
		{
			if(GetPlayersInTeam(TEAM_ZOMBIE) == 1)
			{

			    new p = RandomPlayer();
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)