SA-MP Forums Archive
help me out here - 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: help me out here (/showthread.php?tid=126774)



help me out here - sggassasin - 10.02.2010

Im trying to get a auto team selection going and i need a way to do it iv tryied the following but it dosent work..

Код:
public OnPlayerSpawn(playerid)
{
new string[128];
new string2[128];
GetPlayerName(playerid,string);
string2 = GetPlayerID(string);
if(string2 = 1)
{
//blue
}
else if(string2 = 2)
{
//red
}

return 1;
}
iv tryed that but it hase some problens


Re: help me out here - Babul - 10.02.2010

if you intend to use 2 teams only, then this may help:
Код:
public OnPlayerSpawn(playerid)
{
	if(playerid%2==0)
	{
//blue (team 0, each even playid ID will be assigned to that team)
	}
	else
	{
//red (team 1, odd IDs)
	}
	return 1;
}
if you want to make more than just 2 teams (here f.ex 3), then give hat one a try:
Код:
const MaxTeams=3;//at top of script
Код:
public OnPlayerSpawn(playerid)
{
	if(playerid%MaxTeams==0)//ID 0, 3, 6, 9, etc
	{
//Team0
	}
	else if(playerid%MaxTeams==1)//ID 1, 4, 7, 10, etc
	{
//Team1
	}
	else if(playerid%MaxTeams==2)//ID 2, 5, 8, 11, etc
	{
//Team2
	}
//here you can add more teams, if needed
	return 1;
}



Re: help me out here - DiddyBop - 10.02.2010

https://sampwiki.blast.hk/wiki/PAWN_tuto...eam_deathmatch