SA-MP Forums Archive
I need help :'( (+REP) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help :'( (+REP) (/showthread.php?tid=611422)



I need help :'( (+REP) - MarkNelson - 06.07.2016

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.


Re: I need help :'( (+REP) - Mencent - 06.07.2016

Hello!

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


Re: I need help :'( (+REP) - MarkNelson - 06.07.2016

Код:
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;
}



Re: I need help :'( (+REP) - Mencent - 06.07.2016

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.


Re: I need help :'( (+REP) - MarkNelson - 06.07.2016

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


Re: I need help :'( (+REP) - Mencent - 06.07.2016

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;




Re: I need help :'( (+REP) - MarkNelson - 06.07.2016

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


Re: I need help :'( (+REP) - Mencent - 06.07.2016

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.