AddPlayerClass(265,-1590.5083,716.0220,-5.2422,269.2736,0,0,0,0,0,0); //
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, 0.0, 0.0, 0.0);//your pos here
return 1;
}
The default spawn position is the one you set in OnPlayerClass, if you want that altered you need to move them using SetPlayerPos under OnPlayerSpawn(playerid)
|
new rnd = random(sizeof(SpawnPoints)); SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]); SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]); SetCameraBehindPlayer(playerid);
new Float:SpawnPoints[18][4] = { {-1498.3470,931.3514,7.1875}, {-1639.5243,1201.9764,7.2270}, {-1724.2661,908.4559,24.8906}, {-1969.2166,308.5361,35.1719}, {-1984.5724,185.8245,27.6799}, {-2033.0598,180.5838,28.8429}, {-2093.3123,-78.1040,35.3203}, {-2414.8323,753.4859,35.1719}, {-2761.7749,377.3954,5.3670}, {-2676.8608,264.6314,4.6328}, {-1496.3367,904.7078,7.1875}, {-1749.9264,960.2077,24.8828}, {-1980.9019,1120.1901,53.1256}, {-2243.8044,943.8950,66.6484}, {-2243.4663,753.3155,49.4393}, {-2442.1355,746.6382,35.0156}, {-2760.9460,375.2620,5.0312}, {-2345.2627,-139.9374,35.5547} };
new Float:SpawnPoints[18][3] =
{
{-1498.3470,931.3514,7.1875},
{-1639.5243,1201.9764,7.2270},
{-1724.2661,908.4559,24.8906},
{-1969.2166,308.5361,35.1719},
{-1984.5724,185.8245,27.6799},
{-2033.0598,180.5838,28.8429},
{-2093.3123,-78.1040,35.3203},
{-2414.8323,753.4859,35.1719},
{-2761.7749,377.3954,5.3670},
{-2676.8608,264.6314,4.6328},
{-1496.3367,904.7078,7.1875},
{-1749.9264,960.2077,24.8828},
{-1980.9019,1120.1901,53.1256},
{-2243.8044,943.8950,66.6484},
{-2243.4663,753.3155,49.4393},
{-2442.1355,746.6382,35.0156},
{-2760.9460,375.2620,5.0312},
{-2345.2627,-139.9374,35.5547}
};
new rnd = random(sizeof(SpawnPoints)); SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]); SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]); SetCameraBehindPlayer(playerid);
error 032: array index out of bounds (variable "SpawnPoints")
{-1498.3470, 931.3514, 7.1875},
new Float:SpawnPoints[18][3] = { {-1498.3470,931.3514,7.1875}, {-1639.5243,1201.9764,7.2270}, {-1724.2661,908.4559,24.8906}, {-1969.2166,308.5361,35.1719}, {-1984.5724,185.8245,27.6799}, {-2033.0598,180.5838,28.8429}, {-2093.3123,-78.1040,35.3203}, {-2414.8323,753.4859,35.1719}, {-2761.7749,377.3954,5.3670}, {-2676.8608,264.6314,4.6328}, {-1496.3367,904.7078,7.1875}, {-1749.9264,960.2077,24.8828}, {-1980.9019,1120.1901,53.1256}, {-2243.8044,943.8950,66.6484}, {-2243.4663,753.3155,49.4393}, {-2442.1355,746.6382,35.0156}, {-2760.9460,375.2620,5.0312}, {-2345.2627,-139.9374,35.5547} };
SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);