random spawn
#1

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?
Reply
#2

Because you have one of the same coordinates in both

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

__________________________________
+Rep If I helped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)