explosion detection problem - 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: explosion detection problem (
/showthread.php?tid=608446)
explosion detection problem -
TheSimpleGuy - 01.06.2016
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
for(new j = 0; j < 6; j++)
{
if(IsPlayerConnected(i) && reason == 51 && IsPlayerInRangeOfPoint(playerid, 10.0, pInfo[i][C4X][j], pInfo[i][C4Y][j], pInfo[i][C4Z][j]))
{
killerid = i;
}
}
}
}
return 1;
}
The problem is the killerid never shows up
Re: explosion detection problem -
Dayrion - 01.06.2016
Solution gave in PM.
Re: explosion detection problem -
Jefff - 01.06.2016
pawn Код:
if(killerid != INVALID_PLAYER_ID)
killerid is valid so here you go killerid xD
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(reason == 51)
{
reason = 0;
for(new i = GetPlayerPoolSize(), j; i > -1; i--)
if(IsPlayerConnected(i) && i != playerid)
{
for(j = 0; j < 6; j++)
if(IsPlayerInRangeOfPoint(playerid, 10.0, pInfo[i][C4X][j], pInfo[i][C4Y][j], pInfo[i][C4Z][j]))
{
reason = 1;
killerid = i;
break;
}
if(reason == 1) break;
}
reason = 51;
}
return 1;
}