Teleport player to 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: Teleport player to hospital after death (
/showthread.php?tid=569780)
Teleport player to hospital after death -
dimashr12345 - 02.04.2015
Hey guys!
By default, when a player dies, he is teleported back to the original spawn point. I want to make it so that the player is teleported to the nearest hospital (like in single player). I tried using SetPlayerPos in OnPlayerDeath section to move the player to San Fierro hospital, but it didn't work. Any ideas, guys?
Thanks in advance.
Re: Teleport player to hospital after death -
Lordzy - 02.04.2015
https://sampwiki.blast.hk/wiki/SetSpawnInfo
Re: Teleport player to hospital after death -
CalvinC - 02.04.2015
Do it in OnPlayerSpawn, here's an example:
pawn Код:
new bool:HospitalSpawn[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
HospitalSpawn[playerid] = true;
}
public OnPlayerSpawn(playerid)
{
if(HospitalSpawn[playerid])
{
HospitalSpawn[playerid] = false;
SetPlayerPos(playerid, x, y, z);
}
else
{
// Your other SetPlayerPos code
}
}
Re: Teleport player to hospital after death -
dimashr12345 - 02.04.2015
Quote:
Originally Posted by Lordzy
|
Thanks
Re: Teleport player to hospital after death -
dimashr12345 - 02.04.2015
Quote:
Originally Posted by CalvinC
Do it in OnPlayerSpawn, here's an example:
pawn Код:
new bool:HospitalSpawn[MAX_PLAYERS]; public OnPlayerDeath(playerid, killerid, reason) { HospitalSpawn[playerid] = true; }
public OnPlayerSpawn(playerid) { if(HospitalSpawn[playerid]) { HospitalSpawn[playerid] = false; SetPlayerPos(playerid, x, y, z); } else { // Your other SetPlayerPos code } }
|
Thanks a lot for your help