Skip to content

Instantly share code, notes, and snippets.

@Southclaws
Created March 6, 2014 10:37
Show Gist options
  • Save Southclaws/9387094 to your computer and use it in GitHub Desktop.
Save Southclaws/9387094 to your computer and use it in GitHub Desktop.
/*==============================================================================
Infinite Ammo
Dependencies:
tickcountfix: https://github.com/Southclaw/ScavengeSurvive/blob/master/gamemodes/SS/utils/tickcountfix.pwn
AdvancedWeaponData: https://github.com/Southclaw/AdvancedWeaponData
==============================================================================*/
static
ammo_LastShot[MAX_PLAYERS],
ammo_ShotCounter[MAX_PLAYERS];
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(GetTickCountDifference(ammo_LastShot[playerid], GetTickCount()) < 1000)
{
ammo_ShotCounter[playerid]++;
if(ammo_ShotCounter[playerid] > GetWeaponMagSize(weaponid))
{
// Your own admin report function
TellAllTheAdmins(" > %p fired %d bullets from a %w without reloading.", playerid, ammo_ShotCounter[playerid], weaponid);
return 0;
}
}
else
{
ammo_ShotCounter[playerid] = 1;
}
ammo_LastShot[playerid] = GetTickCount();
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment