30.11.2015, 22:42
Are you tired of spawning at the same place many times? This is a snippet of my way to tackle down this problem. Might be useful for other people.
pawn Код:
new Float:SFSpawn[][] =
{
// X Y Z Angle - SF Spawn
{ -1935.0742, 678.1586, 46.5625, 356.4240 },
{ -1922.5177, 680.0504, 46.5625, 2.6907 },
{ -1934.6843, 264.8631, 41.0469, 276.9846 },
{ -2022.3842, 155.8002, 28.8359, 266.6432 },
{ -2314.1555, -169.0953, 35.3203, 178.2457 },
{ -2126.3633, -383.9755, 35.3359, 2.5950 },
{ -2720.4807, -317.9581, 7.8438, 41.5845 },
{ -2521.2214, -621.2564, 132.7300, 1.2376 },
{ -1928.7382, -790.2328, 32.1506, 273.2949 },
{ -1953.3707, 1339.3734, 7.1875, 174.4267 }
},
playerLastSpawnID[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
findNewSpawn:
new randomiseSpawn = random(sizeof(SFSpawn));
if(playerLastSpawnID[playerid] == randomiseSpawn)
{
SendClientMessage(playerid, -1, "fiding new spawn");
goto findNewSpawn;
return 1;
}
SetPlayerPos(playerid, SFSpawn[randomiseSpawn][0], SFSpawn[randomiseSpawn][1], SFSpawn[randomiseSpawn][2]);
SetPlayerFacingAngle(playerid, SFSpawn[randomiseSpawn][3]);
SetCameraBehindPlayer(playerid);
playerLastSpawnID[playerid] = randomiseSpawn;
return 1;
}