samp.directory
← Скрипты и библиотеки

theamiwn/nex-ac-plus

Behavioural anti-cheat layer for SA-MP with a decaying violation-score system, movement/shot validation, state tracking and flood protection. Single .inc, no plugins.

Библиотека★ 0обновлён 3 дня назадLGPL-2.1Pawnsampctl
Открыть на GitHub

Установка через sampctl

sampctl package install theamiwn/nex-ac-plus

Выполните в папке проекта. sampctl скачает пакет и его зависимости.

Зависит от 1 пакета

README.md

Nex-AC Plus

A behavioural anti-cheat layer for SA-MP 0.3.7+, built around a violation-score system.

Most server-side anti-cheats kick on a single detection, so lag causes false kicks and cheaters learn the exact thresholds. Nex-AC Plus adds points instead. Each suspicious event adds to a per-player score that decays every second. Lag spikes fade away; real cheats pile up points within seconds and get punished.

It is a single .inc file with no plugins required. It can run standalone or next to Nex-AC.


Features

AreaWhat it does
ScoringDecaying per-player violation score, configurable warn/kick thresholds
MovementTime-aware speed, teleport and vertical-fly detection (on foot and in vehicles), with automatic set-back to the last safe position
ShootingFake bullet origin, impossible range, silent-aim hit offsets, damage above weapon maximum, rapid fire, shooting a weapon the player does not own
Server-authoritative stateHealth, armour, money, weapons and jetpack tracked from your script calls; client values above them are flagged and reverted
VehiclesRemote enter, teleport into vehicle, unoccupied-vehicle teleport/speed, vehicle health regeneration
Fake killInvalid killer, killer out of weapon range, invalid reason, double death — sanitised before your gamemode sees them
Flood / networkCallback flood limiter, connection-flood IP blocking, RCON brute-force blocking, high-ping scoring
ExtensibilityOnACPlusFlag (alerts) and OnACPlusPunish (custom ban/kick logic), per-check enable/disable, per-player exemption

Checks

SpeedHack(foot) · SpeedHack(vehicle) · Teleport · FlyHack · RapidFire · FakeShot · SilentAim · DamageHack · HealthHack · ArmourHack · MoneyHack · WeaponHack · Jetpack · VehicleTeleport · VehicleHealth · RemoteEnterVehicle · FakeSpawn · FakeKill · DialogHack · CallbackFlood · HighPing


Installation

  1. Download nex-ac-plus.inc and put it in pawno/include/.
  2. In your gamemode, include it right after a_samp:
#include <a_samp>
#include <nex-ac-plus>
  1. Recompile.

With sampctl:

sampctl package install theamiwn/nex-ac-plus

Quick start

#include <a_samp>
#include <nex-ac-plus>

// Alert admins on each violation (warn = 1 once the score reaches ACP_SCORE_WARN)
forward OnACPlusFlag(playerid, check, points, score, warn);
public OnACPlusFlag(playerid, check, points, score, warn)
{
    if(warn) SendClientMessageToAll(0xFFAA00FF, "[AC] A player is being flagged.");
    return 1;
}

// Handle the punishment yourself. Return 0 to skip the default delayed kick.
forward OnACPlusPunish(playerid, check, score);
public OnACPlusPunish(playerid, check, score)
{
    // write to your ban database here
    return 1; // 1 = default kick
}

Tip: run it in log-only mode first. Return 0 from OnACPlusPunish and just print. This shows how your players actually behave before anyone gets kicked, so you can tune thresholds safely.


Configuration

Override any of these with #define before the include:

DefineDefaultMeaning
ACP_SCORE_KICK100Score that triggers punishment
ACP_SCORE_WARN60Score at which warn=1 is passed to OnACPlusFlag
ACP_DECAY_PER_SEC2Points removed each second
ACP_KICK_DELAY700ms between punishment and Kick()
ACP_MAX_PING800Ping above this adds score every second
ACP_FOOT_SPEED14.0Max horizontal speed on foot (m/s)
ACP_JETPACK_SPEED45.0Max speed with jetpack (m/s)
ACP_VEHICLE_SPEED120.0Max vehicle speed (m/s)
ACP_TELEPORT_MIN_DIST35.0Jumps shorter than this are never "teleports"
ACP_SETBACKtrueMove teleporters back to the last safe position
ACP_NO_NATIVE_HOOKSoffDisable native hooks (see notes below)
ACP_DIALOG_CHECKoffEnable dialog-ID validation
#define ACP_SCORE_KICK 150
#define ACP_FOOT_SPEED 16.0
#include <nex-ac-plus>

API

ACP_EnableCheck(check, bool:enable);       // enable/disable one check globally
ACP_IsCheckEnabled(check);
ACP_SetPlayerExempt(playerid, bool:exempt); // e.g. for admins
ACP_IsPlayerExempt(playerid);
ACP_GetScore(playerid);
ACP_ResetScore(playerid);
ACP_AllowTeleport(playerid, ms = 2000);    // grace period after a server-side teleport
ACP_AllowJetpack(playerid, bool:allow);
ACP_ResyncState(playerid);                 // re-learn health/armour/weapons/money

Callbacks you can implement:

forward OnACPlusFlag(playerid, check, points, score, warn);
forward OnACPlusPunish(playerid, check, score);   // return 0 to cancel the default kick

Check IDs are the ACP_* constants (for example ACP_TELEPORT, ACP_RAPIDFIRE, ACP_WEAPON).


Important notes

  • Include it in the gamemode. State checks (health, armour, money, weapons, jetpack, fake spawn) hook natives such as SetPlayerHealth and GivePlayerWeapon, so they assume one script owns those calls.
  • Filterscripts that change player state: call ACP_ResyncState(playerid) / ACP_AllowTeleport(playerid) from them, or define ACP_NO_NATIVE_HOOKS to keep only the purely behavioural checks.
  • Using it together with Nex-AC: both hook some of the same natives. If you see conflicts, define ACP_NO_NATIVE_HOOKS or disable the overlapping checks in one of them.
  • Dialog validation is opt-in because dialogs shown by filterscripts would otherwise be flagged.
  • Tune before enforcing. The fire-rate and damage tables are deliberately conservative; watch your logs for a few days before tightening.
  • Pay'n'Spray repairs add a few points to the vehicle-health check. They decay, but tune it if it is noisy for you.

Limitations

Server-side checks raise the cost of cheating a lot, but they cannot stop aimbots, wallhacks or modified clients on their own. For that you need a client-side or plugin-based solution. Treat this as one layer of a defence, not the whole defence.


Compatibility

  • SA-MP 0.3.7 (R2+ recommended) and compatible servers
  • Needs GetPlayerPoolSize, BlockIpAddress, OnIncomingConnection and OnPlayerGiveDamage (all 0.3.7+)
  • Compiles warning-free with the standard a_samp stdlib on Pawn compiler 3.10.10

Contributing

Issues and pull requests are welcome. If you report a false positive, please include the server-log line (it contains the check name and reason) and the player's approximate ping.

Credits

Inspired by Nex-AC by NexiusTailer. Nex-AC Plus is an independent implementation, not a copy of its code.

License

LGPL-3.0

anti-cheatanticheatgta-san-andreasincludemultiplayerpawnpawnosa-mpsamp

Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью