RandomPlayer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: RandomPlayer (
/showthread.php?tid=412622)
RandomPlayer -
Blackazur - 02.02.2013
Код:
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.
Re: RandomPlayer - T0pAz - 02.02.2013
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.
AW: RandomPlayer -
Blackazur - 02.02.2013
Put it then random Amount of Players? Like 8 Humans. 2 Zombies?
AW: RandomPlayer -
Blackazur - 02.02.2013
~fixed~
Re: AW: RandomPlayer - T0pAz - 02.02.2013
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.
AW: RandomPlayer -
Blackazur - 02.02.2013
Would you make me this? It were nice, because i dont know how to make it balanced.
AW: RandomPlayer -
Blackazur - 02.02.2013
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)
AW: RandomPlayer -
Blackazur - 02.02.2013
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?
Re: RandomPlayer - T0pAz - 02.02.2013
Check this article out.
https://sampwiki.blast.hk/wiki/Control_Structures
AW: RandomPlayer -
Blackazur - 02.02.2013
But what would happen when i use:
Код:
if(ConnectedPlayers() >= 2)
{
if(GetPlayersInTeam(TEAM_ZOMBIE) == 1)
{
new p = RandomPlayer();
?