SA-MP Forums Archive
Automatic Spawn as Zombie - 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: Automatic Spawn as Zombie (/showthread.php?tid=382680)



Automatic Spawn as Zombie - Blackazur - 04.10.2012

How can i make that, when Team Human is full and Player choose nevertheless Human, that he spawn automatic as Zombie? He are the Code:

Quote:

case TEAM_ARMY:
{
if(zt < ct)
{
NoSuccess(playerid,"This Team is full. Please choose another Team.");
return 0;
}
else




AW: Automatic Spawn as Zombie - Blackazur - 04.10.2012

I dont know what you mean, which code under which public?


AW: Automatic Spawn as Zombie - Blackazur - 04.10.2012

under OnPlayerRequestSpawn

Код:
public OnPlayerRequestSpawn(playerid)
{
	new zt, ct;
	for(new i=0;i<MAX_PLAYERS;i++)
	{
	    if(i != playerid)
	    {
	        if(IsPlayerConnected(i))
	        {
	            switch(gTeam[i])
	            {
	                case TEAM_ARMY: ct ++;
	                case TEAM_ZOMBIE: zt++;
				}
	        }
		}
	}
	switch(GetPVarInt(playerid,"TEAM"))
	{
	    case TEAM_ARMY:
	    {
	        if(zt < ct)
			{
				NoSuccess(playerid,"This Team is full. Please choose another Team.");
                	return 0;
			}
			else
			{
			    TextDrawHideForPlayer(playerid,streifen1);
				TextDrawHideForPlayer(playerid,streifen2);
				ClearAnimations(playerid);
				gTeam[playerid] = GetPVarInt(playerid,"TEAM");
			}
	    }
	    case TEAM_ZOMBIE:
	    {
	        if(zt > ct)
			{
				NoSuccess(playerid,"This Team is full. Please choose another Team.");
				return 0;
			}
			else
			{
			    TextDrawHideForPlayer(playerid,streifen1);
				TextDrawHideForPlayer(playerid,streifen2);
				ClearAnimations(playerid);
				gTeam[playerid] = GetPVarInt(playerid,"TEAM");
			}
	    }
	}
	return 1;
}



AW: Automatic Spawn as Zombie - Blackazur - 04.10.2012

Work, thx for Help i give you +1 Rep.