Skip to content

Commit

Permalink
#44: Улучшение античита на оружие
Browse files Browse the repository at this point in the history
- Использование GetPlayerWeapon и GetPlayerAmmo вместо GetPlayerWeaponData (эти
функции возвращают точные данные)
  • Loading branch information
ziggi committed May 18, 2015
1 parent e6fe47f commit 0855e1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions sources/player/player.inc
Expand Up @@ -266,6 +266,7 @@ stock player_Sync(playerid)
pt_jetpack_Check(playerid);
pt_health_Sync(playerid);
pt_armour_Sync(playerid);
pt_weapon_Check(playerid);
JailPlayerCheck(playerid);
return 1;
Expand Down
2 changes: 0 additions & 2 deletions sources/player/player_weapon.inc
Expand Up @@ -87,8 +87,6 @@ stock pl_weapon_Sync(playerid)
continue;
}
pt_weapon_Check(playerid, i, weapon);
if (PlayerWeapons[playerid][i][pbullets] > weapon[1]) {
PlayerWeapons[playerid][i][pbullets] = weapon[1];
}
Expand Down
15 changes: 10 additions & 5 deletions sources/protections/weaponhack.inc
Expand Up @@ -39,20 +39,25 @@ pt_weapon_SaveConfig(file_config)
* For timer
*/
pt_weapon_Check(playerid, slotid, weapon[2])
pt_weapon_Check(playerid)
{
if (!IsEnabled) {
return 0;
}
new
weaponid = GetPlayerWeapon(playerid),
ammo = GetPlayerAmmo(playerid),
slotid = GetWeaponSlot(weaponid);
// weapon
if (PlayerWeapons[playerid][slotid][pwid] != weapon[0] && weapon[0] != 0) {
Admin_SendProtectReport(playerid, _(PROTECTION_WEAPON_WEAPON), PlayerWeapons[playerid][slotid][pwid], weapon[0]);
if (PlayerWeapons[playerid][slotid][pwid] != weaponid && weaponid != 0) {
Admin_SendProtectReport(playerid, _(PROTECTION_WEAPON_WEAPON), PlayerWeapons[playerid][slotid][pwid], weaponid);
}
// ammo
if (PlayerWeapons[playerid][slotid][pbullets] < weapon[1]) {
Admin_SendProtectReport(playerid, _(PROTECTION_WEAPON_AMMO), PlayerWeapons[playerid][slotid][pbullets], weapon[1]);
if (PlayerWeapons[playerid][slotid][pbullets] < ammo) {
Admin_SendProtectReport(playerid, _(PROTECTION_WEAPON_AMMO), PlayerWeapons[playerid][slotid][pbullets], ammo);
}
return 1;
}

0 comments on commit 0855e1e

Please sign in to comment.