SA-MP Forums Archive
random spawn - 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)
+--- Thread: random spawn (/showthread.php?tid=596416)



random spawn - GeneralAref - 17.12.2015

i have this code:
Код:
new Float:iRandomSpawns[][] =
{
	{211.5670,1812.2867,21.8594,3.5209}, 
	{247.0072,1860.3899,14.0840,357.8343},
	{287.3070,1813.4673,4.7109,2.8478},
	{279.6079,1855.2161,8.7649,269.7870}
};

new Float:dRandomSpawns[][] =
{
	{211.5670,1812.2867,21.8594,3.5209},
	{-1481.2003, 2642.5127, 58.7790,0.0000},
	{-1513.7363, 2614.4705, 55.8271, 0.0000},
	{-1513.7363, 2614.4705, 55.8271, 180.0000}
};
public OnPlayerSpawn(playerid)
{
    if(GetPlayerTeam(playerid) == 1)
    {
    new Random = random(sizeof(iRandomSpawns));
	SetPlayerPos(playerid, iRandomSpawns[Random][0], iRandomSpawns[Random][1], iRandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, iRandomSpawns[Random][3]);
    }
    else if(GetPlayerTeam(playerid) == 2)
    {
    new Random = random(sizeof(dRandomSpawns));
	SetPlayerPos(playerid, dRandomSpawns[Random][0], dRandomSpawns[Random][1], dRandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, dRandomSpawns[Random][3]);
    }
	return 1;
}
but often team one spawn in team two.how to fix it?


Re: random spawn - MrCallum - 17.12.2015

Because you have one of the same coordinates in both

Код:
{211.5670,1812.2867,21.8594,3.5209},
- Change it.

__________________________________
+Rep If I helped.