On Death Animation Help
#1

When a player dies, it should freeze the player and Apply a death animation, leaving the player on the ground for 60 seconds before he can respawn. The problem is the animation... Other players can see the animation, but the player who dies can't...

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	Dead[playerid] = 1;
	TogglePlayerControllable(playerid,false);
	ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1);
	SendClientMessage(playerid,-1,"You can respawn after 60 seconds");
	GameTextForPlayer(playerid,"~r~You are DEAD",1000,1);
	SetTimerEx("TogglePlayerRespawn",60000,false,"d",playerid);
	return 0;
}
[FIXED CODE]

Код:
public OnPlayerRequestClass(playerid, classid)
{
	ApplyAnimation(playerid,"PED","FLOOR_hit_f",4.1,0,1,1,1,0);
	return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	Dead[playerid] = 1;
	TogglePlayerControllable(playerid,false);
	ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1);
	SendClientMessage(playerid,-1,"You can respawn after 60 seconds");
	GameTextForPlayer(playerid,"~r~You are DEAD",1000,1);
	SetTimerEx("TogglePlayerRespawn",60000,false,"d",playerid);
	return 0;
}
Reply
#2

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
Dead[playerid] = 1;
    
TogglePlayerControllable(playerid,false);
     
TogglePlayerSpectating(playerid1); //Allow the player to spectate - 1 = true, 0 = false.
     
PlayerSpectatePlayer(playeridplayerid); //Player's spectating himself.
    
ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1);
    
SendClientMessage(playerid,-1,"You can respawn after 60 seconds");
    
GameTextForPlayer(playerid,"~r~You are DEAD",1000,1);
    
SetTimerEx("TogglePlayerRespawn",60000,false,"d",playerid);
    return 
0;

Reply
#3

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
Dead[playerid] = 1;
    
TogglePlayerControllable(playerid,false);
     
TogglePlayerSpectating(playerid1); //Allow the player to spectate - 1 = true, 0 = false.
     
PlayerSpectatePlayer(playeridplayerid); //Player's spectating himself.
    
ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1);
    
SendClientMessage(playerid,-1,"You can respawn after 60 seconds");
    
GameTextForPlayer(playerid,"~r~You are DEAD",1000,1);
    
SetTimerEx("TogglePlayerRespawn",60000,false,"d",playerid);
    return 
0;

Didn't needed that. It already freeze him when he use 0 at the last second parameter.
You must use 1 at the second parameter.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	Dead[playerid] = 1;
	TogglePlayerControllable(playerid,false);
	ApplyAnimation(playerid,"PED","KO_skid_back",4.1,1,1,1,1,0,1);
	SendClientMessage(playerid,-1,"You can respawn after 60 seconds");
	GameTextForPlayer(playerid,"~r~You are DEAD",1000,1);
	SetTimerEx("TogglePlayerRespawn",60000,false,"d",playerid);
	return 0;
}
forward TogglePlayerRespawn(playerid);
public TogglePlayerRespawn(playerid)
{
	ClearAnimations(playerid);
}
Reply
#4

Quote:
Originally Posted by adithegman
Посмотреть сообщение
The problem is the animation... Other players can see the animation, but the player who dies can't...
[/CODE]
PHP код:
TogglePlayerSpectating(playerid1); 
PHP код:
Didn't needed that. It already freeze him 
Really dude ? Read the fuction of "TogglePlayerSpectating" first: https://sampwiki.blast.hk/wiki/TogglePlayerSpectating
Reply
#5

You too read this
https://sampwiki.blast.hk/wiki/ApplyAnimation

the freeze column. Uff..
Reply
#6

His problem is that dead player can't see the animation, not being freezed.
Reply
#7

Edited
Reply
#8

Ops i didn't saw that you wrote TogglePlayerSpectating , Sorry and yes he is right..
Reply
#9

Quote:
Originally Posted by adithegman
Посмотреть сообщение
Edited
My code works?
Reply
#10

No, it wasn't gonna work from the beginning, when you togglespectator the corpse of the player despawns... Tried it out and didn't work, the camera points at the sea
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)