SA-MP Forums Archive
How to make random spawn locations?????? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make random spawn locations?????? (/showthread.php?tid=370491)



How to make random spawn locations?????? - Roroana_Zorro - 20.08.2012

Hey guys is there a way to create random spawn locations when teleporting to a location ? The map i created has a car deathmatch teleport . But when players join this teleport,they spawn at the same location.So i want players to spawn players at different parts of the map when teleported.
Ur help will be really appreciated


Re: How to make random spawn locations?????? - Devilxz97 - 20.08.2012

next time use Search Function.
here's the tutorial.
https://sampforum.blast.hk/showthread.php?tid=162488


Re: How to make random spawn locations?????? - xSkullx - 20.08.2012

Or you can try this, it's simple and easier :
pawn Код:
//-------------------------RANDOM SPAWN-----------------------------------------
    switch(random(13))
    {
    case 0:
    {
        SetPlayerPos(playerid,403.8893,2450.7117,16.5000); // aa
    }
    case 1:
    {
        SetPlayerPos(playerid,1286.9517,1277.3640,10.8203); // lvair
    }
    case 2:
    {
        SetPlayerPos(playerid,2003.8845,1544.9501,14.4018); // lv
    }
    case 3:
    {
        SetPlayerPos(playerid,-359.6938,1590.2939,76.7771); // drift
    }
    case 4:
    {
        SetPlayerPos(playerid,-2674.5376,1338.2960,19.5308);  // jizzy
    }
    case 5:
    {
        SetPlayerPos(playerid,-1974.9318,252.0767,35.1719); // sf
    }
    case 6:
    {
        SetPlayerPos(playerid,-1394.3132,-192.7000,14.1462); // sfair
    }
    case 7:
    {
        SetPlayerPos(playerid,539.5621,-1878.8409,3.7659); // plaja
    }
    case 8:
    {
        SetPlayerPos(playerid,1509.4786,-1707.0342,14.0469); // ls
    }
    case 9:
    {
        SetPlayerPos(playerid,1546.4701,-2639.8149,13.7103); // lsair
    }
    case 10:
    {
        SetPlayerPos(playerid,2489.0271,-1666.3361,13.3438); // grove
    }
    case 11:
    {
        SetPlayerPos(playerid,-2308.1331,-1635.5887,483.8453); // chilliad
    }
    case 12:
    {
        SetPlayerPos(playerid,-2228.9978,2325.5264,7.6303); //pimps
    }
}
Add it under OnPlayerSpawn !