I need help :'( (+REP)
#1

hello, how to set a player death anim?
can someone show me an example? because i did everything in my own GM script but it's not works so help me please.
Reply
#2

Hello!

You can show us your code which don't work. So we can help you with that.
Reply
#3

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ApplyAnimation(playerid, "PED", "KO_shot_front",4.1,1,1,1,1,1);
    SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    SendClientMessage(killerid,COLOR_LIGHTBLUE,"Good Job +1 For killing that enemy");
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    PlayerPlaySound(playerid,4804,0.0, 0.0, 10.0);
    return 1;
}
Reply
#4

You must write it like this:
PHP код:
//global in the script:
new Float:DeathX[MAX_PLAYERS],Float:DeathY[MAX_PLAYERS],Float:DeathZ[MAX_PLAYERS],bool:death[MAX_PLAYERS];
public 
OnPlayerDeath(playeridkilleridreason)
{
    
death[playerid] = true;
    
GetPlayerPos(playerid,DeathX[playerid],DeathY[playerid],DeathZ[playerid]);
    if(
killerid != INVALID_PLAYER_ID)
    {
        
SetPlayerScore(killeridGetPlayerScore(killerid) + 1);
        
SendClientMessage(killerid,COLOR_LIGHTBLUE,"Good Job +1 For killing that enemy");
        
PlayerInfo[killerid][pKills]++;
    }
    
PlayerInfo[playerid][pDeaths]++;
    
PlayerPlaySound(playerid,4804,0.00.010.0);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(
death[playerid] == true)
    {
        
SetPlayerPos(playerid,DeathX[playerid],DeathY[playerid],DeathZ[playerid]);
        
ApplyAnimation(playerid"PED""KO_shot_front",4.1,1,1,1,1,1);
    }
    return 
1;

After OnPlayerDeath is OnPlayerSpawn called and you will be spawn after you are death. So you need an boolean (a variable) to set a value that you are death and spawn you back in OnPlayerSpawn.

My english is bad, but I hope you understand me.
Reply
#5

oh look what happend now?
i have an error IG
When the player dies he still do the normal dead animation. i wanted a head shoot death animation or something
Reply
#6

Oh, and like this?
PHP код:
//global in the script:
new Float:DeathX[MAX_PLAYERS],Float:DeathY[MAX_PLAYERS],Float:DeathZ[MAX_PLAYERS],bool:death[MAX_PLAYERS];
public 
OnPlayerDeath(playeridkilleridreason)
{
    
ApplyAnimation(playerid"PED""KO_shot_front",4.1,1,1,1,1,1);
    
death[playerid] = true;
    
GetPlayerPos(playerid,DeathX[playerid],DeathY[playerid],DeathZ[playerid]);
    if(
killerid != INVALID_PLAYER_ID)
    {
        
SetPlayerScore(killeridGetPlayerScore(killerid) + 1);
        
SendClientMessage(killerid,COLOR_LIGHTBLUE,"Good Job +1 For killing that enemy");
        
PlayerInfo[killerid][pKills]++;
    }
    
PlayerInfo[playerid][pDeaths]++;
    
PlayerPlaySound(playerid,4804,0.00.010.0);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(
death[playerid] == true)
    {
        
SetPlayerPos(playerid,DeathX[playerid],DeathY[playerid],DeathZ[playerid]);
    }
    return 
1;

Reply
#7

Yes like that.
when the player die he do the normal death animation but when he respawned he re-do it much times
Reply
#8

OK, yet I know what do you mean.
You can't change the standart animation (only with a mod). Server side you can't change it. Sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)