Random spawns?
#1

I used to be a master at scripting but i havent done this shit for litterally 2-3 years and i have forgot a lot.
How do i make it so when a player dies they spawn at a random location, I already have the coordinates.
Thankyou!
Reply
#2

pawn Код:
new Float:RandomSpawn[][4] = {
    {coordx, coordy, coordz, coorda},
    {coordx, coordy, coordz, coorda},
    {coordx, coordy, coordz, coorda}
};

public OnPlayerSpawn(playerid)
{
    new rands = random(sizeof(RandomSpawn));
    SetPlayerPos(playerid, RandomSpawn[rands][0], RandomSpawn[rands][1], RandomSpawn[rands][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rands][3]);
    return 1;
}
Reply
#3

https://sampwiki.blast.hk/wiki/Random
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)