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



Admin only spawn - SnG.Scot_MisCuDI - 17.12.2011

How can i make it so only admins can spawn at these locations (randomly each log in)
pawn Код:
1619.651245,2156.124755,10.671875
1611.9025,2141.2773,10.8203// face east 270
1612.9706,2125.5913,10.8203 // face east 270
1609.9360,2088.3264,10.6719 // face east 270
1623.9277,2079.1467,10.6719 // face west
and ill change the isadmin part to my admin fs


Re: Admin only spawn - Tanush123 - 17.12.2011

under your includes

pawn Код:
new Float:aspawn[5][3] =
{
    {1619.651245,2156.124755,10.671875},
    {1611.9025,2141.2773,10.8203},
    {1612.9706,2125.5913,10.8203},
    {1609.9360,2088.3264,10.6719},
    {1623.9277,2079.1467,10.6719}
};
Onplayerspawn
pawn Код:
if(//If player is admin)
{
   
    new ran = random(sizeof(aspawn));
    SetPlayerPos(playerid,aspawn[ran][0],aspawn[ran][1],aspawn[ran][2]);
}



Re: Admin only spawn - Mrki_Drakula - 17.12.2011

PHP код:
new Float:RandomSpawn[][6] =
{
    {
1619.651245,2156.124755,10.671875},
    {
1611.9025,2141.2773,10.8203},
    {
1612.9706,2125.5913,10.8203},
    {
1609.9360,2088.3264,10.6719},
    {
1623.9277,2079.1467,10.6719},
};
public 
OnPlayerSpawn(playerid)
{
    if(
IsPlayerAdmin(playerid)
    {
       new 
rand random(sizeof(RandomSpawn));
       
SetPlayerPos(playeridRandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);//bla bla here
       
return 1;
    }
    return 
1;

That should work.


Re: Admin only spawn - Tanush123 - 17.12.2011

doesnt [6] has to be [3] because its X Y Z


Re: Admin only spawn - Mrki_Drakula - 17.12.2011

6 is a number of spawn places + 1 to be safe.


Re: Admin only spawn - Tanush123 - 17.12.2011

errr lol read this
http://forum.sa-mp.com/showthread.ph...=random+spawns


Re: Admin only spawn - Mrki_Drakula - 17.12.2011

Lol! Wow!


Re: Admin only spawn - SnG.Scot_MisCuDI - 17.12.2011

(135) : error 003: declaration of a local variable must appear in a compound block
(135) : error 017: undefined symbol "ran"
pawn Код:
new ran = random(sizeof(aspawn));
(136) : error 017: undefined symbol "ran"
pawn Код:
SetPlayerPos(playerid,aspawn[ran][0],aspawn[ran][1],aspawn[ran][2]);



Re: Admin only spawn - Tanush123 - 17.12.2011

change
pawn Код:
new Float:aspawn[5][3] =
{
    {1619.651245,2156.124755,10.671875},
    {1611.9025,2141.2773,10.8203},
    {1612.9706,2125.5913,10.8203},
    {1609.9360,2088.3264,10.6719},
    {1623.9277,2079.1467,10.6719}
};
to
pawn Код:
new Float:aspawn[][3] =
{
    {1619.651245,2156.124755,10.671875},
    {1611.9025,2141.2773,10.8203},
    {1612.9706,2125.5913,10.8203},
    {1609.9360,2088.3264,10.6719},
    {1623.9277,2079.1467,10.6719}
};



Re: Admin only spawn - SnG.Scot_MisCuDI - 19.12.2011

Thanks. And is there a way to make a specific person spawn at a certain coordinates? Like assign the spawn to there name only