Different spawn points
#1

Hello , Ill be fast because I have to go.

For eg.

I want when someone connects to spawn randomly at the Airports

SetPlayerPos(playerid,Los Santos Airport)
etc

and..I tried but , when someone dies I want same to spawn at neareast hospital.
I think for that I have to get areas right?
Reply
#2

yes u have
with /save
then go to documents-gta folder- samp -savedpositions
get the x,y,z
and then create the random spawns...
Reply
#3

Use boloean.
pawn Код:
new bool:Dead[MAX_PLAYERS];

//OnPlayerDeath
Dead[playerid] = true;

//OnPlayerSpawn
if(Dead[playerid])
{
   //Spawn in Hospital
   Dead[playerid] = false;
}
Reply
#4

well that I know , I mean

I just put

public OnPlayerDeath

SetPlayerPos(playerid,-2424.2395,1003.6310,30.247);
SetPlayerPos(playerid,-5624.2395,6003.6310,15.5687);
SetPlayerPos(playerid,-9024.2395,853.6310,30.232);

And it will spawn randomly?
Not to the first one?
Reply
#5

https://sampwiki.blast.hk/wiki/random

^ Solution ^
Reply
#6

Quote:
Originally Posted by FrostDoggy
Посмотреть сообщение
well that I know , I mean

I just put

public OnPlayerDeath

SetPlayerPos(playerid,-2424.2395,1003.6310,30.247);
SetPlayerPos(playerid,-5624.2395,6003.6310,15.5687);
SetPlayerPos(playerid,-9024.2395,853.6310,30.232);

And it will spawn randomly?
Not to the first one?
No lol
top of gm
pawn Код:
new Float:RandomSpawns[][] =
{
    {-2424.2395,1003.6310,30.247},
    {-5624.2395,6003.6310,15.5687},
    {-9024.2395,853.6310,30.232}
};
ONPLAYERSpawn:
pawn Код:
new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
Reply
#7

pawn Код:
new bool:Dead[MAX_PLAYERS];

//OnPlayerDeath
Dead[playerid] = true;

//OnPlayerSpawn
if(Dead[playerid])
{
    switch(random(3))
    {
        case 0: SetPlayerPos(playerid,xxx,yyy,zzz);
        case 1: SetPlayerPos(playerid,xxx,yyy,zzz);
        case 2: SetPlayerPos(playerid,xxx,yyy,zzz);
    }
    Dead[playerid] = false;
}
Reply
#8

hum
i think we cant do it onplayerdeath
cuz player will spawn and go back to normal spawn
so...the dead boolean must be OnPlayerSpawn
edit : i didnt saw varthshenon post sorry
Reply
#9

Thanks!

Tested & Works.

For spawning place I do the same?
Reply
#10

Yes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)