Random SetPlayerPos
#3

You would do it similar to how it's done on the random spawns on the wiki with a slight difference:

pawn Код:
new Float:RandomSpawn[][4] =
{
    // Positions, (X, Y, Z and Facing Angle)
    {-2796.9854, 1224.8180, 20.5429, 192.0335}, //array slot 0
    {-2454.2170, 503.8759, 30.0790, 267.2932}, //array slot 1
    {-2669.7322, -6.0874, 6.1328, 89.8853} //array slot 2
};
#define MAX_SPAWNS 3
new rSpawn;

public OnPlayerSpawn(playerid) //Or wherever you want to random spawn them.
{

    SetPlayerPos(playerid, RandomSpawn[rSpawn][0], RandomSpawn[rSpawn][1],RandomSpawn[rSpawn][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
    rSpawn++; //Next array slot.
    if(rSpawn == MAX_SPAWNS) rSpawn = 0;
    //If we get to the end of the array, it's reset to 0.
    //This means if you have over 3 players then it's going to spawn at least 2 people at the same place.
    return 1;
}
Reply


Messages In This Thread
Random SetPlayerPos - by Slepur - 27.08.2013, 18:28
Re: Random SetPlayerPos - by Slepur - 27.08.2013, 23:31
Re: Random SetPlayerPos - by [HiC]TheKiller - 28.08.2013, 01:03
Re: Random SetPlayerPos - by Slepur - 28.08.2013, 01:44

Forum Jump:


Users browsing this thread: 1 Guest(s)