how to make a random spawn?
#1

hey everyone,
i want to make a random spawn becuz everytime when there are like 10 or 15 players in my server they kill each other and i dont want that so how to make a random spawn? i made it like this but it isnt working it now goes to 1 place:
Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid, 2614.5420,-2468.1777,3.0000);
    SetPlayerPos(playerid, 2644.9099,-2022.1721,13.5469);
    SetPlayerPos(playerid, -2706.4773,218.7441,4.1797);
    return 1;
}
someone can tell me how to make it that everytime a player respawns he goes to another place?
niels
Reply
#2

Код:
//on the top 
new Float:Rs[][4] = 
{
    {2614.5420,-2468.1777,3.0000, 192.0335},
    {2644.9099,-2022.1721,13.5469, 267.2932},
    {-2706.4773,218.7441,4.1797, 89.8853}
    //replace/and add more spawns here
};

//on player spawn 
public OnPlayerSpawn(playerid)
{
  new rand = random(sizeof(Rs));
  SetPlayerPos(playerid,Rs[rand][0], Rs[rand][1],Rs[rand][2]);
  SetPlayerFacingAngle(playerid,Rs[rand][3]);
  return 1;
}
Reply
#3

nice man i would never figured that out my self XD thanks bro REP +
Reply
#4

Код:
new Float:gRandomPlayerSpawns[ 5 ][ 3 ] = {
{ Pos1 },
{ Pos2 },
{ Pos3 }, 
{ Pos4 },
{ ect   }
};
and now on: OnPlayerSpawn:
Код:
SetPlayerRandomSpawn( playerid );
And thats all...
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)