SA-MP Forums Archive
hospital tele. - 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: hospital tele. (/showthread.php?tid=461484)



hospital tele. - BoU3A - 02.09.2013

if player die how can i make him teleport to the hospital?


Re: hospital tele. - zrelly - 02.09.2013

Код:
public OnPlayerDeath(playerid, killerid, reason)
{

SetPlayerPos(playerid, 1552.5980,-1676.2185,16.1953,76.0868); //He will spawn at LSPD but you can change the cords to the Hospital
    return 1;
}
Hope this helped,


Re: hospital tele. - Borg - 02.09.2013

zrelly, players can avoid it by pressing f4, but you can prevent it
pawn Код:
new playerDied[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
...
    playerDied[playerid] = 0;
...
}

public OnPlayerDeath(playerd, killerid, reason)
{
    ...
    playerDied[playerid] = 1;
    ...
}

public OnPlayerSpawn(playerid)
{
    ...
    if(playerDied[playerid])
    {
        SetPlayerPos(playerid, ...);
        SendClientMessage(playerid, 0xFF3333, "Welcome to the Hospital!");
        playerDied[playerid] = 0;
    }
}



Re: hospital tele. - BoU3A - 02.09.2013

Thanks.