Help with OnPlayerDeath +rep
#1

https://www.youtube.com/watch?v=0r5gDs2SdrU

When a player dies he tp aways for a second and then comes to his death point, i want the player to go to the animation right as they die.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	SetNormalColor(playerid);
	ResetVariables(playerid);
	FullResetPlayerWeapons(playerid);
	FullResetPlayerClothes(playerid);
	CheckPlayerCurrentCall(playerid);
	RemovePlayerMask(playerid);
	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, 1000.0);
		SCM(playerid, COLOR_LIGHTRED, "(( THIS PLAYER IS BRUTALLY WOUNDED ))");
		DeathReason[playerid] = Create3DTextLabel("(( THIS PLAYER IS BRUTALLY WOUNDED ))", COLOR_LIGHTRED, 30.0, 40.0, 50.0, 10.0, 0, 0);
		Attach3DTextLabelToPlayer(DeathReason[playerid], playerid, 0.0, 0.0, 0.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");
		FreezePlayer(playerid);
		OnAnim{playerid} = true;
		ApplyAnimation(playerid,"WUZI","CS_Dead_Guy",3.5,0,0,0,1,0);
	}
}
Reply
#2

I think is something with samp u cant do shit about it but i am not sure doe!
Reply
#3

Well, you can check the player health under OnPlayerTakeDamage and if it is below like 20 you can put him in that anim and with TogglePlayerControllable(someid, 0); so he wouldn't get that teleport, however, if he somehow get damaged more than 100 and dies like if he fall from a building or get shotted with 40 dmg while he has 30 health, the OnPlayerTakeDamage wouldn't work because he'd be death therefore you would still have to use both OnPlayerDeath and OnPlayerTakeDamage.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)