SA-MP Forums Archive
How do i make a player spawn at hospital after death - 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 do i make a player spawn at hospital after death (/showthread.php?tid=397228)



How do i make a player spawn at hospital after death - Ben_Hatfield - 03.12.2012

Ive been trying to figure this out for awhile, i have a RP server and in it every time a player dies they eather spawn where they died or where they where on the last login. So if anyone can help me out i would really appreciate it. Thanks


Re: How do i make a player spawn at hospital after death - LarzI - 03.12.2012

Make a global variable
pawn Код:
new playerDied[MAX_PLAYERS]
Then in under
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
put this:
pawn Код:
playerDied[playerid] = 1;
Then lastly under
pawn Код:
public OnPlayerSpawn(playerid)
put this:
pawn Код:
if(playerDied[playerid])
{
    SetPlayerPos(playerid, hospitalX, hospitalY, hospitalZ); //replace with actual coordinates
}
Cheers


Re: How do i make a player spawn at hospital after death - Ben_Hatfield - 03.12.2012

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Make a global variable
pawn Код:
new playerDied[MAX_PLAYERS]
Then in under
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
put this:
pawn Код:
playerDied[playerid] = 1;
Then lastly under
pawn Код:
public OnPlayerSpawn(playerid)
put this:
pawn Код:
if(playerDied[playerid])
{
    SetPlayerPos(playerid, hospitalX, hospitalY, hospitalZ); //replace with actual coordinates
}
ive had this problem in the past, my pawno always crashes when i try to compile with these lines


Re: How do i make a player spawn at hospital after death - LarzI - 03.12.2012

Make sure you don't have duplicates of the publics


Re: How do i make a player spawn at hospital after death - Ben_Hatfield - 03.12.2012

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Make sure you don't have duplicates of the publics
i checked. there is no duplicates.


Re: How do i make a player spawn at hospital after death - Ben_Hatfield - 04.12.2012

i really gotta get this to work, its a major problem since its in a rp server


Re: How do i make a player spawn at hospital after death - Nordic - 04.12.2012

Quote:
Originally Posted by Ben_Hatfield
Посмотреть сообщение
ive had this problem in the past, my pawno always crashes when i try to compile with these lines
You probly have messed up brackets