Admin only spawn
#1

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
Reply
#2

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]);
}
Reply
#3

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.
Reply
#4

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

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

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

Lol! Wow!
Reply
#8

(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]);
Reply
#9

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}
};
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)