Detecting player killed in CreateExplosion - 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: Detecting player killed in CreateExplosion (
/showthread.php?tid=607024)
Detecting player killed in CreateExplosion -
TheSimpleGuy - 13.05.2016
Can someone help me build it? I do not have any single idea on how to make it
Re: Detecting player killed in CreateExplosion -
Konstantinos - 13.05.2016
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.
Re: Detecting player killed in CreateExplosion -
Micko123 - 13.05.2016
Why don't you just SendDeathMessage if it is DM/FR server. If it is not then follow Konstantinos example