GetPlayerFacingAngle after SetPlayerFacingAngle
#4

I don't remember how I did it exactly, but is was for a deathmatch map. It was something similar as this:
Код:
new Float: DeathmatchSpawns[][] = {
	{100.0, 100.0, 100.0, 100.0},
	{more deathmatch spawns}
};

stock SpawnPlayers()
{
	for (new p; p != MAX_PLAYERS; p++)
	{
		new Float: pos[3];
		for (new p; p != MAX_PLAYERS; p++)
		{
			new spawn = random(sizeof(DeathmatchSpawns)), bool: goodspawn;
			
			while (goodspawn == false)
			{
				new bool: someonenearby, Float: p2Pos[3];
				for (new p2; p2 != MAX_PLAYERS; p2++)
				{
					GetPlayerPos(playerid, p2Pos[0], p2Pos[1], p2Pos[2]);
					if (InRangeOf(25.0, DeathmatchSpawns[spawn][0], DeathmatchSpawns[spawn][1], DeathmatchSpawns[spawn][2], p2Pos[0], p2Pos[1], p2Pos[2])
					{
						someonenearby = true;
					}
				}
				if (someonenearby == false) {goodspawn = true;}
				else {spawn = random(sizeof(DeathmatchSpawns));}
			}
			
			SetPlayerPos(p, DeathmatchSpawns[s][0], DeathmatchSpawns[s][1], DeathmatchSpawns[s][2]);
			SetPlayerFacingAngle(p, DeathmatchSpawns[s][3]);
			SetCameraBehindPlayer(p);
		}
	}
	return 1;
}
The goal of the script is to spawn all the players in the deathmatch, without them spawning too close to each other.

Of course, IsPlayerInRangeOfPoint could be used too, but who's says that one gets updated? But still, I'm not sure if this was actually the case. Although, I have changed the original script for this reason, I think. (The script I use nowadays isn't the same as this anymore.)
Reply


Messages In This Thread
GetPlayerFacingAngle after SetPlayerFacingAngle - by MP2 - 06.06.2012, 23:34
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by Basssiiie - 09.06.2012, 12:46
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by [MM]IKKE - 09.06.2012, 12:50
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by Basssiiie - 09.06.2012, 13:09
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by Patrik356b - 09.06.2012, 17:20
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by [MM]IKKE - 09.06.2012, 18:03
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by leong124 - 09.06.2012, 18:29
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by MP2 - 10.06.2012, 01:12
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by cessil - 10.06.2012, 02:07
Re: GetPlayerFacingAngle after SetPlayerFacingAngle - by MP2 - 10.06.2012, 02:19

Forum Jump:


Users browsing this thread: 3 Guest(s)