Random Spawn
#1

Can you tell me how i can do random spawns for a dm.

do when they tele to the dm some people start at different places to others.

Thanks
Reply
#2

Код:
new rand = random(SPAWNPOINT_AMOUNT);
switch(rand)
{
    case 0:
    {
        SetPlayerPos
        SetPlayerFacingAngle
    }
    case 1:
    {
        SetPlayerPos
        SetPlayerFacingAngle
    }
    ...
}
Reply
#3

Fallout's way is an option, OR:

pawn Код:
new RandomSpawns[][4] = { // X - Y - Z- Angle
{1250.00000, -1250.00000, 50.00000, 360},
{180.00000, -30.00000, 2.00000, 300},
{1250.00000, -1250.00000, 3.50000, 20} //Add a new line for each new spawn position, the last line must be WITHOUT comma.
};

public OnPlayerSpawn(playerid)
{
  new rand = random(sizeof(RandomSpawns));
  SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);
  SetPlayerFacingAngle(playerid, RandomSpawns[rand][4]);
  return 1;
}
Reply
#4

Код:
SetPlayerFacingAngle(playerid, RandomSpawns[rand][3]);
not to show you you made a little mistake,
but to make sure the next question isn't: I get error; how to fix it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)