SA-MP Forums Archive
team problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: team problem (/showthread.php?tid=252611)



team problem - muhib777 - 02.05.2011

a player can connect and choose from two teams and spawn at their team spawn.
but if they die they spawn elsewhere with the red and blue team.
how do i prevent this so the teams always spawn at their teams spawn?


Re: team problem - Lorenc_ - 02.05.2011

write some code on onplayerspawn?


Re: team problem - Mike Garber - 02.05.2011

pawn Код:
// Under the callback 'OnPlayerSpawn'
if(gteam[playerid] == Team_BLUE)
{
// Spawn at blue
}

if(gteam[playerid] == Team_RED)
{
// Spawn at red
}
I don't know if you use gteam because you didn't show any code, but it sounds like you do.


Re: team problem - muhib777 - 02.05.2011

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 1)
		{
		if(response)
		{
			switch(listitem)
			{
				case 0:
				{
					SendClientMessage(playerid, 0x2641FEAA, "You have choosen the Team Rangers");
					SetPlayerTeam(playerid, 1);
					SetPlayerSkin(playerid, 287);
					SetPlayerPos(playerid, 191.82862854004,2074.44140625,22.644439697266); 
					GivePlayerWeapon(playerid, 30, 9999);
	   				GivePlayerWeapon(playerid, 4, 1);
	   				GivePlayerWeapon(playerid, 22, 9999);
	   				GivePlayerWeapon(playerid, 25, 9999);
	   				GivePlayerWeapon(playerid, 46, 9999);
	  				GivePlayerWeapon(playerid, 43, 9999);
	  				SetPlayerColor(playerid, 0x2641FEAA);
  				}
                case 1:
				{
					SendClientMessage(playerid, 0xFF0000FF, "You have choosen the Team Spetsnaz");
					SetPlayerTeam(playerid, 2); 
					SetPlayerSkin(playerid, 285);
					SetPlayerPos(playerid, 403.69519042969,2535.6623535156,16.54570007); 
					GivePlayerWeapon(playerid, 30, 9999);
	   				GivePlayerWeapon(playerid, 4, 1);
	   				GivePlayerWeapon(playerid, 22, 9999);
	   				GivePlayerWeapon(playerid, 25, 9999);
	   				GivePlayerWeapon(playerid, 46, 9999);
	  				GivePlayerWeapon(playerid, 43, 9999);
	  				SetPlayerColor(playerid, 0xFF0000FF);
				}
			}
		}
    	else if(!response) return SendClientMessage(playerid, -1, "You have to choose a team !") && ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST, "Choose a Team","Rangers\nSpetsnaz","Choose","Exit");
	}
	return 0;
}

public OnPlayerRequestSpawn(playerid)
{
	ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST, "Choose a Team","Rangers\nSpetsnaz","Choose","Exit");
	return 1;
}
i dont use gteam


Re: team problem - park4bmx - 02.05.2011

So you would need to make a main dialog under OnPlayerSpawn that shows what teams you want then