SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 13/05/2011, 07:13 PM   #1
Sid_Alexander
Big Clucker
 
Sid_Alexander's Avatar
 
Join Date: Apr 2011
Location: U.S.A
Posts: 97
Reputation: 0
Default How To Make People Spawn On Different Position?

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?
__________________
Sid_Alexander is offline  
Old 13/05/2011, 07:19 PM   #2
Sasino97
High-roller
 
Sasino97's Avatar
 
Join Date: Dec 2010
Location: Napoli, Italia
Posts: 1,327
Reputation: 64
Default Re: How To Make People Spawn On Different Position?

pawn Code:
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
__________________
Code:
Sasino97 is offline  
Old 13/05/2011, 07:21 PM   #3
Sid_Alexander
Big Clucker
 
Sid_Alexander's Avatar
 
Join Date: Apr 2011
Location: U.S.A
Posts: 97
Reputation: 0
Default Re: How To Make People Spawn On Different Position?

Quote:
Originally Posted by [GF]Sasino97 View Post
pawn Code:
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?
__________________
Sid_Alexander is offline  
Old 13/05/2011, 07:27 PM   #4
Laronic
Huge Clucker
 
Laronic's Avatar
 
Join Date: Mar 2011
Location: Somewhere you're not
Posts: 435
Reputation: 57
Default Re: How To Make People Spawn On Different Position?

pawn Code:
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;
}
__________________
Laronic is offline  
Old 13/05/2011, 07:35 PM   #5
Sid_Alexander
Big Clucker
 
Sid_Alexander's Avatar
 
Join Date: Apr 2011
Location: U.S.A
Posts: 97
Reputation: 0
Default Re: How To Make People Spawn On Different Position?

Quote:
Originally Posted by CyberGhost View Post
pawn Code:
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
__________________
Sid_Alexander is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make people spawn at the location they /q'ed anant Help Archive 6 09/04/2011 05:32 PM
[Help]Last Position - Spawn igal4576 Help Archive 12 17/08/2010 11:12 AM
Car back to old spawn position. gRfd Help Archive 6 30/05/2010 08:11 PM
Player doesn't spawn to the last position he was at. pagie1111 Help Archive 4 19/01/2010 02:37 PM
Spawn Position Save Jbosh123 Help Archive 3 28/08/2009 12:35 PM


All times are GMT. The time now is 10:22 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.