Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Extremely simple CBug detector/Anti-CBug
- Version 1.0 (1/23/2014)
- Made by Mauzen (msoll(at)web.de)
- This include allows to unsync extra deagle shots automatically,
- and calls OnPlayerCBug once a cbug was detected.
- Use as you like, but dont remove this header.
- */
- #if (!defined VectorSize)
- #error "The Anti-CBug include requires at least SA-MP 0.3z RC3"
- #endif
- // The minimum interval between two shots, everything below that
- // is treated as CBug
- #define CBUG_INTERVAL 700
- // Used for getting shot intervals
- new lastDShot[MAX_PLAYERS];
- // If 1, extra cbug shots are unsynced automatically
- new removeCBugs = 1;
- // If 1, OnPlayerCBug is called on cbug usages
- new alertCBugs = 1;
- // Callback forward
- forward OnPlayerCBug(playerid, interval);
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- // Avoid driveby false alarms
- if (!IsPlayerInAnyVehicle(playerid) && (removeCBugs || alertCBugs))
- {
- // Only execute for deagle shots
- if (weaponid == 24)
- {
- // Normal deagle shots shouldnt be faster than 700ms
- // Check if time difference is positive to avoid GetTickCount-reset false alarms
- if (GetTickCount() - lastDShot[playerid] < CBUG_INTERVAL && GetTickCount() - lastDShot[playerid] >= 0)
- {
- if (alertCBugs) CallLocalFunction("OnPlayerCBug", "ii", playerid, GetTickCount() - lastDShot[playerid]);
- return !removeCBugs;
- }
- lastDShot[playerid] = GetTickCount();
- }
- }
- return CallLocalFunction("ACBUG_OnPlayerWeaponShot", "iiiifff", playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
- }
- #if defined _ALS_OnPlayerWeaponShot
- #undef OnPlayerWeaponShot
- #else
- #define _ALS_OnPlayerWeaponShot
- #endif
- #define OnPlayerWeaponShot ACBUG_OnPlayerWeaponShot
- forward ACBUG_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement