Quote:
Originally Posted by HellSphinX
Hmm you can use OnPlayerTakeDamage to get around this, code:
pawn Код:
new LastAttacker[MAX_PLAYERS]; // a variable to store the last player who gives damage new LastAttackerWeapon[MAX_PLAYERS]; // a variable to store the weapon of the last player who gives damage
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) { if(IsPlayerConnected(issuerid)) // if the issuer connected { LastAttacker[playerid] = issuerid; // now the last one who attacked our victim is issuerid LastAttackerWeapon[playerid] = weaponid; // the weapon of the issuerid which was used to damage the victim } return 1; }
public OnPlayerDeath(playerid, killerid, reason) { if(reason == 54) // Splat. You can change that if you want { if(IsPlayerConnected(LastAttacker[playerid])) // if the last player who gave damage is connected { SendDeathMessage(LastAttacker[playerid], playerid, LastAttackerWeapon[playerid]); // Other stuff } else // not connected { SendDeathMessage(INVALID_PLAYER_ID, playerid, reason); // Other stuff } } return 1; }
Edit:
Or (for the OnPlayerDeath part)
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { if(killerid == INVALID_PLAYER_ID) { if(IsPlayerConnected(LastAttacker[playerid])) // if the last player who gave damage is connected { SendDeathMessage(LastAttacker[playerid], playerid, LastAttackerWeapon[playerid]); // Other stuff } else // not connected { SendDeathMessage(INVALID_PLAYER_ID, playerid, reason); // Other stuff } } return 1; }
|
Excuse me , but wouldn't OnPlayerTakeDamage remove lag shooting from the server?