Onplayerdeath actors
#2

PHP код:
new death_actor[MAX_PLAYERS]; // Storing actor ids in an array for every player (seeing how there should only be 1 "death actor" per player)
new RemoveActorTimer[MAX_PLAYERS]; // Storing timer IDs in order to kill them.
public OnPlayerDeath(playeridkilleridreason)
{
    if(
killerid != INVALID_PLAYER_ID)
    {
        if(!
IsPlayerNPC(playerid))
        {
            new 
name[24], kname[30], string[64];
            new 
gunname[32], playername[MAX_PLAYER_NAME 1], killername[MAX_PLAYER_NAME 1];
            
GetWeaponName(reasongunnamesizeof(gunname));
            
GetPlayerName(playeridname24);
            
GetPlayerName(killeridkname30);
            
format(stringsizeof(string), "%s has wasted %s using a %s."killernameplayernamegunname);
            
SendMessageToAllAdmins(string, -1);
            
GetPlayerPos(playerid,Float:x,Float:y,Float:z);
            if(
IsValidActor(death_actor[playerid])) // Debugging; in the case someone dies within 5 seconds of their last death.
            
{
                
DestroyActor(death_actor[playerid]); // If for some reason the actor already exists, destroy/delete it before creating another one.
                
KillTimer(RemoveActorTimer[playerid]); // Kill the already running timer to avoid it deleting the actor that's about to be created fresh prior to the time we want.
            
}
            
death_actor[playerid] = CreateActor("%s""%s""%s""%s"pSkin(playerid), Float:xFloat:yFloat:z); // Create the actor and assign the ID, not entirely sure why you're passing an actor's "modelid" as a string here but I'll assume you have a reason . . .
            
ApplyActorAnimation(death_actor[playerid], "WUZI","CS_Dead_Guy",4.1,1,1,1,1,0,1); // Applying the animation, this was your code.
            
RemoveActorTimer[playerid] = SetTimerEx("RemovePlayerDeathActor"5000false"i"playerid);
        }
    }
}  
forward RemovePlayerDeathActor(playerid);
public 
RemovePlayerDeathActor(playerid)
{
    if(
IsValidActor(death_actor[playerid])) DestroyActor(death_actor[playerid]); // Removes the "death actor".
    
return 1;

Reply


Messages In This Thread
Onplayerdeath actors - by Zeus666 - 24.09.2018, 16:32
Re: Onplayerdeath actors - by CantBeJohn - 24.09.2018, 16:53
Re: Onplayerdeath actors - by Zeus666 - 24.09.2018, 16:59
Re: Onplayerdeath actors - by VVWVV - 24.09.2018, 17:03
Re: Onplayerdeath actors - by Zeus666 - 24.09.2018, 17:07
Re: Onplayerdeath actors - by VVWVV - 24.09.2018, 17:10
Re: Onplayerdeath actors - by Zeus666 - 24.09.2018, 17:12
Re: Onplayerdeath actors - by Zeus666 - 24.09.2018, 17:30
Re: Onplayerdeath actors - by UFF - 24.09.2018, 17:51
Re: Onplayerdeath actors - by VVWVV - 24.09.2018, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)