Detecting player killed in CreateExplosion
#1

Can someone help me build it? I do not have any single idea on how to make it
Reply
#2

If the "reason" of the player's death is 51 (Explosion) then you can check if the player is in range of the last explosion within 5 seconds from the time the explosion was created. If the type of the explosion creates fire, you may need to increase the interval.

pawn Код:
enum e_Explosion
{
    Float: e_X,
    Float: e_Y,
    Float: e_Z,
    Float: e_radius,
    e_timestamp
};

new Explosion[e_Explosion];
pawn Код:
stock HF_CreateExplosion(Float: X, Float: Y, Float: Z, type, Float: radius)
{
    Explosion[e_X] = X;
    Explosion[e_Y] = Y;
    Explosion[e_Z] = Z;
    Explosion[e_radius] = radius;
    Explosion[e_timestamp] = gettime();
   
    return CreateExplosion(X, Y, Z, type, radius);
}

#if defined _ALS_CreateExplosion
    #undef CreateExplosion
#else
    #define _ALS_CreateExplosion
#endif

#define CreateExplosion HF_CreateExplosion
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if (reason == 51 && gettime() - Explosion[e_timestamp] < 5 && IsPlayerInRangeOfPoint(playerid, Explosion[e_radius], Explosion[e_X], Explosion[e_Y], Explosion[e_Z]))
    {
        // code..
    }
    return 1;
}
Bare in mind that it cannot be 100 percent accurate but from nothing.
Reply
#3

Why don't you just SendDeathMessage if it is DM/FR server. If it is not then follow Konstantinos example
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)