OnPlayerDeath and OnPlayerSpawn - 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: OnPlayerDeath and OnPlayerSpawn (
/showthread.php?tid=572122)
OnPlayerDeath and OnPlayerSpawn -
rOps - 25.04.2015
Hi, when player dies I want to set his position with SetPlayerPos, but when system calling OnPlayerSpawn, player respawns in spawn, not in hospital.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID)
{
PlayerInfo[playerid][JustDie] = 1;
StarPlayerTextDrawUpdate(playerid, 0, 0, 0, 0, 0, USING_LOADING_LOAD);
}
else
{
PlayerInfo[playerid][JustDie] = 1;
StarPlayerTextDrawUpdate(playerid, 0, 0, 0, 0, 0, USING_LOADING_LOAD);
SetPlayerWantedLevel (killerid, GetPlayerWantedLevel(killerid) + 4 + random(6));
}
return 1;
}
Ant this is my code under OnPlayerSpawn:
Код:
if(PlayerInfo[playerid][JustDie] > 0)
{
SetPlayerPos (playerid, -16.8834,146.2760,999.0519);
SetPlayerFacingAngle(playerid, 265.3234);
PlayerInfo[playerid][JustDie] = 0;
}
Re: OnPlayerDeath and OnPlayerSpawn -
Mencent - 25.04.2015
Hello!
Try this:
PHP код:
if(PlayerInfo[playerid][JustDie] > 0)
{
SetPlayerPos(playerid, -16.8834,146.2760,999.0519);
SetPlayerFacingAngle(playerid, 265.3234);
PlayerInfo[playerid][JustDie] = 0;
return 1;
}
That is the code for OnPlayerSpawn.
Mencent