SA-MP Forums Archive
How To Make People Spawn On Different Position? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How To Make People Spawn On Different Position? (/showthread.php?tid=254964)



How To Make People Spawn On Different Position? - Sid_Alexander - 13.05.2011

Im making a new gamemode, which is called swat, I wanna know how can i spawn the 2 teams to different positions, the swat to different and the criminal to different, currently im using gRandomSpawns and gCopplayerspawns can anyone help me please?


Re: How To Make People Spawn On Different Position? - Sasino97 - 13.05.2011

pawn Код:
static rand;

public OnPlayerSpawn(playerid)
{
  rand = random(sizeof(gRandomPlayerSpawns));
  SetPlayerPos(playerid, gRandomPlayerSpawns[0][rand],gRandomPlayerSpawns[1][rand],gRandomPlayerSpawns[2][rand]);
  return 1;
}
It's something like that


Re: How To Make People Spawn On Different Position? - Sid_Alexander - 13.05.2011

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
pawn Код:
static rand;

public OnPlayerSpawn(playerid)
{
  rand = random(sizeof(gRandomPlayerSpawns));
  SetPlayerPos(playerid, gRandomPlayerSpawns[0][rand],gRandomPlayerSpawns[1][rand],gRandomPlayerSpawns[2][rand]);
  return 1;
}
It's something like that
i have it, but the problem is when i choose cop skin 285 it doesn spawn player to different position, spawns to the criminal position, can you provide the code please?


Re: How To Make People Spawn On Different Position? - Laronic - 13.05.2011

pawn Код:
new Float:RandomCopSpawn[][4] =
{
    //The X, Y, Z, FaceAngle coords
    {-2796.9854, 1224.8180, 20.5429, 192.0335},
    {-2454.2170, 503.8759, 30.0790, 267.2932},
    {-2669.7322, -6.0874, 6.1328, 89.8853}
};

new Float:RandomTerroristSpawn[][4] =
{
    //The X, Y, Z, FaceAngle coords
    {-2796.9854, 1224.8180, 20.5429, 192.0335},
    {-2454.2170, 503.8759, 30.0790, 267.2932},
    {-2669.7322, -6.0874, 6.1328, 89.8853}
};

public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_COP)
    {
        new RandomSpawn = random(sizeof(RandomCopSpawn));
        SetPlayerPos(playerid, RandomCopSpawn[RandomSpawn][0], RandomCopSpawn[RandomSpawn][1], RandomCopSpawn[RandomSpawn][2]);
        SetPlayerFacingAngle(playerid, RandomCopSpawn[RandomSpawn][3]);
    }
    else if(gTeam[playerid] == TEAM_TERRORIST)
    {
        new RandomSpawn = random(sizeof(RandomTerroristSpawn));
        SetPlayerPos(playerid, RandomTerroristSpawn[RandomSpawn][0], RandomTerroristSpawn[RandomSpawn][1], RandomTerroristSpawn[RandomSpawn][2]);
        SetPlayerFacingAngle(playerid, RandomTerroristSpawn[RandomSpawn][3]);
    }
    return 1;
}



Re: How To Make People Spawn On Different Position? - Sid_Alexander - 13.05.2011

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
pawn Код:
new Float:RandomCopSpawn[][4] =
{
    //The X, Y, Z, FaceAngle coords
    {-2796.9854, 1224.8180, 20.5429, 192.0335},
    {-2454.2170, 503.8759, 30.0790, 267.2932},
    {-2669.7322, -6.0874, 6.1328, 89.8853}
};

new Float:RandomTerroristSpawn[][4] =
{
    //The X, Y, Z, FaceAngle coords
    {-2796.9854, 1224.8180, 20.5429, 192.0335},
    {-2454.2170, 503.8759, 30.0790, 267.2932},
    {-2669.7322, -6.0874, 6.1328, 89.8853}
};

public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_COP)
    {
        new RandomSpawn = random(sizeof(RandomCopSpawn));
        SetPlayerPos(playerid, RandomCopSpawn[RandomSpawn][0], RandomCopSpawn[RandomSpawn][1], RandomCopSpawn[RandomSpawn][2]);
        SetPlayerFacingAngle(playerid, RandomCopSpawn[RandomSpawn][3]);
    }
    else if(gTeam[playerid] == TEAM_TERRORIST)
    {
        new RandomSpawn = random(sizeof(RandomTerroristSpawn));
        SetPlayerPos(playerid, RandomTerroristSpawn[RandomSpawn][0], RandomTerroristSpawn[RandomSpawn][1], RandomTerroristSpawn[RandomSpawn][2]);
        SetPlayerFacingAngle(playerid, RandomTerroristSpawn[RandomSpawn][3]);
    }
    return 1;
}
Pawn Stops working