Making a random spawn
#1

I need some help scripting a random spawn.
I have 2 classes, and each one has a set of 3 spawn points.
I made the player choose where they spawn when they enter the server, but I need them to spawn randomly after they die. How can I do that?
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=162488
Reply
#3

thank you
Reply
#4

pawn Код:
new Died[MAX_PLAYERS];
new SpawnPoints[][4] = {
{X, Y, Z, Angle},
{X2, Y2, Z2, Angle2},
{X3, Y3, Z3, Angle3} //Replace X, Y, Z and Angle with the X, Y, Z coordinates and the angle that the player is facing, respectively.
};
public OnPlayerConnect(playerid)
{
    Died[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(Died[playerid] == 1)
    {
        new rand = random(sizeof(SpawnPoints));
        SetPlayerPos(playerid, SpawnPoints[rand][0], SpawnPoints[rand][1], SpawnPoints[rand][2]);
        SetPlayerFacingAngle(playerid, SpawnPoints[rand][3]);
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    Dead[playerid] = 1;
    return 1;
}
EDIT: Bit late? xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)