SA-MP Forums Archive
HELP!!! - 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: HELP!!! (/showthread.php?tid=286053)



HELP!!! - 26_RUSSS - 26.09.2011

how to do players spawn at the hospital after his death


Re: HELP!!! - Kostas' - 26.09.2011

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid,X,Y,Z);
    return 1;
}



Re: HELP!!! - Jeffry - 26.09.2011

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, X, Y, Z);
    //X Y Z are the coordinates, which you have to look for. Just go to the hospital and type /save.
    //Then go to My Documents/GTA San Andreas Userfiles/SAMP/savedpositions.txt and copy the XYZ of the last line.
    return 1;
}



Re: HELP!!! - antonio112 - 26.09.2011

I'd rather do something else:
pawn Код:
//On top of your script
new Killed[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        Killerd[playerid] = 1;
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
        if(Killed[playerid] == 1)
        {
                SetPlayerPos(playerid, X, Y, Z);
                Killed[playerid] = 0;
        }
    return 1;
}



Re: HELP!!! - Jeffry - 26.09.2011

Quote:
Originally Posted by antonio112
Посмотреть сообщение
I'd rather do something else:
But this would only set them to the hospital if they get shot by someone else.


Re: HELP!!! - Cameltoe - 26.09.2011

Rather make an "JustLogged" variable, to check if the player has just logged in. Players should probably not spawn at the hospital once they spawn without dying.


Re: HELP!!! - antonio112 - 26.09.2011

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
But this would only set them to the hospital if they get shot by someone else.
Yea ... but without that, you'd spawn at hospital after you just logged in. He probably uses it for a RP gamemode and could have other variables aswell. Anyhow, it was just an example. Like Cameltoe said, he should use a variable instead of my example.