team problem
#1

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?
Reply
#2

write some code on onplayerspawn?
Reply
#3

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.
Reply
#4

Код:
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
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)