How To Make People Spawn On Different Position?
#1

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

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
Reply
#3

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

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;
}
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)