SA-MP Forums Archive
Random spawn - 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: Random spawn (/showthread.php?tid=552878)



Random spawn - 1fret - 27.12.2014

I made a random spawn system but it spawns the player even in the sea and on the farm near las vagas here is the code

pawn Код:
new Float:mRandom[][] =
{
    // medic spawns
    (2022.5699,-1403.6254,17.1843,204.0663),
    {2037.3314,-1405.4860,17.2327,120.0922},
    {2042.2224,-1413.4026,17.1708,118.2122},
    (2042.0806,-1428.0522,17.1641,102.2321),
    (1173.4116,-1326.4989,15.3921,277.6771),
    (1179.6117,-1317.2227,14.1530,232.2433),
    (1179.7563,-1329.5791,14.1629,319.0374)
};
new Float:RandomSpawns[][] =
{
    // Citizens randomspawn
    {2248.0364,-1795.5726,13.5469,298.5540},
    {802.8392,-1461.2540,13.5514,91.9204},
    {555.6499,-1470.1956,14.8389,106.1107},
    {879.0840,-1643.7054,13.5547,188.8017},
    {953.4117,-1646.6171,13.5353,99.1449},
    {1108.2329,-1797.9961,16.5938,83.8996},
    {1154.4369,-1771.1111,16.5992,3.3083},
    {1211.2217,-1747.9554,13.5940,358.4953},
    {1222.5406,-1814.0406,16.5938,210.8310},
    {1939.0420,-1115.8081,27.4204,185.9672},
    {2347.6270,-1168.2070,27.9051,355.3419},
    {2468.1184,-1278.4116,30.1045,80.6933},
    {2783.9297,-1305.9507,38.7601,261.3833}
};
new Float:Policeran[][] =
{
    //Policerandomspawn
    {1580.2329,-1635.3047,13.5606,98.7155},
    {1543.2629,-1608.3750,13.3828,246.5869},
    {1568.9258,-1692.6268,5.8906,165.7461},
    {1528.1733,-1679.7382,5.8906,268.4970},
    (1607.6638,-1716.5436,6.2188,46.0518),
    (3058.1326,-2021.9517,12.2501,5.2946),
    (3040.8132,-2012.6700,10.8078,9.0547),
    (3084.3630,-2011.8096,10.8078,81.4353)
};

//onplayerspawn

    if(gTeam[playerid] == TEAM_CIT)
    {
        SelectSkill(playerid);
        new Random = random(sizeof(RandomSpawns));
        SetPlayerPos(playerid, RandomSpawns[Random][0],RandomSpawns[Random][1], RandomSpawns[Random][2]);
    }
    else if( gTeam[playerid] == TEAM_POLICE)
    {
        new PRandom = random(sizeof(Policeran));
        SetPlayerPos(playerid,Policeran[PRandom][0],Policeran[PRandom][1], Policeran[PRandom][2]);
        ServerWeapon(playerid, 23, 100);
        ServerWeapon(playerid, 3, 0);
        ServerWeapon(playerid, 31, 100);
        HasLawEnforcementRadio[playerid] =1;
    }
    else if( gTeam[playerid] == TEAM_MEDIC)
    {
        new MRandom = random(sizeof(mRandom));
        SetPlayerPos(playerid, mRandom[MRandom][0],  mRandom[MRandom][1],   mRandom[MRandom][2]);
        ServerWeapon(playerid, 23, 100);
        ServerWeapon(playerid, 4, 0);
    }
what could be the problem


Re: Random spawn - Schneider - 27.12.2014

In both medic and police arrays you have used '(' & ')' instead of '{' & '}'


Re: Random spawn - 1fret - 27.12.2014

Thanks