Can u detect killed by rpg and who killed him? also with grenade and satchel?
#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


Messages In This Thread
Can u detect killed by rpg and who killed him? also with grenade and satchel? - by chrism11 - 22.01.2012, 18:47
Re: Can u detect killed by rpg and who killed him? also with grenade and satchel? - by Whitetiger - 25.01.2012, 03:57
Re: Can u detect killed by rpg and who killed him? also with grenade and satchel? - by chrism11 - 29.01.2012, 13:03

Forum Jump:


Users browsing this thread: 1 Guest(s)