OnPlayerDeath Help (+rep)
#1

When my script recalls OnPlayerDeath it crashes/restarts the server, i looked in the logs and it showed nothing just it restarting.

here is my code,

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Text3D:BrutWounded = Create3DTextLabel("(( THIS PLAYER IS BRUTALLY WOUNDED ))", 0xFF6347AA, 30.0, 20.0, 50.0, 20.0, 0);
    Attach3DTextLabelToPlayer(BrutWounded, playerid, 0.0, 0.0, 0.7);
    ClearAnimations(playerid);
    ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
    ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
    SetIntVar(playerid, "JustDied", 1);
	SavePlayerPos(playerid);
    SetNormalColor(playerid);
    TogglePlayerControllable(playerid, false);
 	ResetVariables(playerid);
 	FullResetPlayerWeapons(playerid);
 	FullResetPlayerClothes(playerid);
 	CheckPlayerCurrentCall(playerid);
	RemovePlayerMask(playerid);
	PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
    SetInterior(playerid, PlayerInfo[playerid][pInt]);
    SetWorld(playerid, PlayerInfo[playerid][pWorld]);
   	SetPlayerCameraLookAt(playerid, killerid);
    SetPlayerHealth(playerid, 15.0);
    GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
    GiveCash(playerid, -500);
    SCM(playerid, COLOR_PINK, "EMT: Your Medical Bills are $500");
    SCM(playerid, COLOR_LIGHTRED, "You are Brutally Wounded. If a medic or anyone else doesn't save you, you will die.");
    SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
	SetHunger(playerid, 100.0);
  	return 1;
}
Reply
#2

Try using the print function after every function under your OnPlayerDeath callback so you can see the last function that is processed before your server crashes.
Reply
#3

Quote:
Originally Posted by Matical
Посмотреть сообщение
When my script recalls OnPlayerDeath it crashes/restarts the server, i looked in the logs and it showed nothing just it restarting.

here is my code,

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Text3D:BrutWounded = Create3DTextLabel("(( THIS PLAYER IS BRUTALLY WOUNDED ))", 0xFF6347AA, 30.0, 20.0, 50.0, 20.0, 0);
    Attach3DTextLabelToPlayer(BrutWounded, playerid, 0.0, 0.0, 0.7);
    ClearAnimations(playerid);
    ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
    ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
    SetIntVar(playerid, "JustDied", 1);
	SavePlayerPos(playerid);
    SetNormalColor(playerid);
    TogglePlayerControllable(playerid, false);
 	ResetVariables(playerid);
 	FullResetPlayerWeapons(playerid);
 	FullResetPlayerClothes(playerid);
 	CheckPlayerCurrentCall(playerid);
	RemovePlayerMask(playerid);
	PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
    SetInterior(playerid, PlayerInfo[playerid][pInt]);
    SetWorld(playerid, PlayerInfo[playerid][pWorld]);
   	SetPlayerCameraLookAt(playerid, killerid);
    SetPlayerHealth(playerid, 15.0);
    GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
    GiveCash(playerid, -500);
    SCM(playerid, COLOR_PINK, "EMT: Your Medical Bills are $500");
    SCM(playerid, COLOR_LIGHTRED, "You are Brutally Wounded. If a medic or anyone else doesn't save you, you will die.");
    SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
	SetHunger(playerid, 100.0);
  	return 1;
}
Maybe because you're applying animation twice? Just sayin'
Reply
#4

I rewrite my death system to this, it all works it just instead of falling straight at the point they got killed they teleport away for a second to the airport and then to the spot,

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	SetNormalColor(playerid);
	ResetVariables(playerid);
	FullResetPlayerWeapons(playerid);
	FullResetPlayerClothes(playerid);
	CheckPlayerCurrentCall(playerid);
	RemovePlayerMask(playerid);
	OnAnim{playerid} = true;
	ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
	if(!isAdminDuty(playerid))
	{
		MakePlayerWounded(playerid);
	}
	SetHunger(playerid, 100.0);
  	return 1;
}
Код:
stock MakePlayerWounded(playerid)
{
	if(PlayerInfo[playerid][pJailed] == 0)
	{
	    SetIntVar(playerid, "JustDied", 1);
	    SavePlayerPos(playerid);
	}
	return 1;
}
Код:
public CheckWounded(playerid)
{
	if(GetIntVar(playerid, "JustDied") == 1)
	{
		PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetInterior(playerid, PlayerInfo[playerid][pInt]);
		SetWorld(playerid, PlayerInfo[playerid][pWorld]);
		SetPlayerCameraPos(playerid,PlayerInfo[playerid][pPosX]+3,PlayerInfo[playerid][pPosY]+3,PlayerInfo[playerid][pPosZ]+3);
		SetPlayerCameraLookAt(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetPlayerHealth(playerid, 25.0);
		GiveCash(playerid, -500);
		GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
    	SCM(playerid, COLOR_PINK, "EMT: Your Medical Bills are $500");
    	SCM(playerid, COLOR_LIGHTRED, "You are Brutally Wounded. If a medic or anyone else doesn't save you, you will die.");
    	SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
		FreezePlayer(playerid);
		OnAnim{playerid} = true;
		ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",4.1,0,1,1,1,1);
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)