/******************************************************************************/
new leEx_Killer [MAX_PLAYERS],
leEx_Reason [MAX_PLAYERS];
/******************************************************************************/
forward OnPlayerTakeSyncDamage(playerid, issuerid, Float:amount, reason);
public OnPlayerTakeSyncDamage(playerid, issuerid, Float:amount, reason)
{
new Float:health, Float:armour;
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);
if(armour > 0)
{
if(amount > armour)
SetPlayerArmour(playerid, 0.0);
else
SetPlayerArmour(playerid, armour - amount);
amount -= armour;
}
if(health > 0 && amount > 0)
{
if(amount > health)
{
leEx_Killer [playerid] = issuerid;
leEx_Reason [playerid] = reason;
SetPlayerHealth(playerid, 0.0);
}
else
SetPlayerHealth(playerid, health - amount);
}
return 1;
}
/******************************************************************************/
public OnPlayerSpawn(playerid)
{
SetPlayerTeam(playerid, 0);
leEx_Killer[playerid] = INVALID_PLAYER_ID;
leEx_Reason[playerid] = 0;
#if defined leEx_OnPlayerSpawn
return leEx_OnPlayerSpawn(playerid);
#else
return 1;
#endif
}
#if defined leEx_OnPlayerSpawn
forward leEx_OnPlayerSpawn(playerid);
#endif
#if defined _ALS_OnPlayerSpawn
#undef OnPlayerSpawn
#else
#define _ALS_OnPlayerSpawn
#endif
#define OnPlayerSpawn leEx_OnPlayerSpawn
/******************************************************************************/
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(leEx_Killer[playerid]))
{
killerid = leEx_Killer[playerid];
reason = leEx_Reason[playerid];
}
#if defined leEx_OnPlayerDeath
return leEx_OnPlayerDeath(playerid, killerid, reason);
#else
return 1;
#endif
}
#if defined leEx_OnPlayerDeath
forward leEx_OnPlayerDeath(playerid, killerid, reason);
#endif
#if defined _ALS_OnPlayerDeath
#undef OnPlayerDeath
#else
#define _ALS_OnPlayerDeath
#endif
#define OnPlayerDeath leEx_OnPlayerDeath
/******************************************************************************/
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if(IsPlayerStreamedIn(playerid, damagedid) && IsPlayerStreamedIn(damagedid, playerid))
OnPlayerTakeSyncDamage(damagedid, playerid, amount, weaponid);
#if defined leEx_OnPlayerGiveDamage
return leEx_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
#else
return 1;
#endif
}
#if defined leEx_OnPlayerGiveDamage
forward leEx_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
#endif
#if defined _ALS_OnPlayerGiveDamage
#undef OnPlayerGiveDamage
#else
#define _ALS_OnPlayerGiveDamage
#endif
#define OnPlayerGiveDamage leEx_OnPlayerGiveDamage
/******************************************************************************/
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(IsPlayerConnected(issuerid) && (weaponid == 37 || weaponid == 49 || weaponid == 50 || weaponid == 51 || (GetPlayerState(issuerid) == PLAYER_STATE_DRIVER && (weaponid == 31 || weaponid == 38))))
OnPlayerTakeSyncDamage(playerid, issuerid, amount, weaponid);
#if defined leEx_OnPlayerTakeDamage
return leEx_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
#else
return 1;
#endif
}
#if defined leEx_OnPlayerTakeDamage
forward leEx_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
#endif
#if defined _ALS_OnPlayerTakeDamage
#undef OnPlayerTakeDamage
#else
#define _ALS_OnPlayerTakeDamage
#endif
#define OnPlayerTakeDamage leEx_OnPlayerTakeDamage
/******************************************************************************/
#include <leEx>
SA-MP 0.3z RC: Updated shooting sync for bullet weapons Shots fired by players are now lag compensated, meaning you can aim at the skin instead of lead aiming. |
if(!IsPlayerInStreamedIn(playerid, damagedid) || IsPlayerInStreamedIn(damagedid, playerid)) return 1;
Your missing the most important thing in OnPlayerGiveDamage()
pawn Код:
|
1.) Fake OnPlayerGiveDamage() messages
2.) Packetloss/bugged players where only one player streams in for one but not the other |