Can u detect killed by rpg and who killed him? also with grenade and satchel?
#1

like the title says pls post how or just the code what ever you prefer, thx
Reply
#2

pawn Код:
new LastShot[MAX_PLAYERS] = -1, Shooter[MAX_PLAYERS] = -1;
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) {
    LastShot[playerid] = weaponid;
    Shooter[playerid] = issuerid;
}

public OnPlayerDeath(playerid, killerid, reason) {
    if(LastShot[playerid] != -1 && Shooter[playerid] == killerid) reason = LastShot[playerid];
}

public OnPlayerSpawn(playerid) {
    LastShot[playerid] = -1;
    Shooter[playerid] = -1
}
or

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    reason = GetPlayerWeapon(killerid);
}
I would use the first example cause it fixes a bug if the player changes weapon after firing rpg,nade etc

*UNTESTED CODE*
Reply
#3

thx but it didnt work for some reason, it didnt get the killerid, or the reason
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)