OnPlayerDeath and OnPlayerSpawn
#1

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;
}
Reply
#2

Hello!

Try this:
PHP код:
if(PlayerInfo[playerid][JustDie] > 0)
{
    
SetPlayerPos(playerid, -16.8834,146.2760,999.0519);
    
SetPlayerFacingAngle(playerid265.3234);
    
PlayerInfo[playerid][JustDie] = 0;
    return 
1;

That is the code for OnPlayerSpawn.

Mencent
Reply


Forum Jump:


Users browsing this thread: