Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ==================================================
- Anti-Ammospam
- v1.0
- By HuiCheng Gaming
- ==================================================
- W W W . H C Y X . O R G
- ==================================================
- Notice: If you find any bugs, report it by
- adding me 'hcyxsq' on skype.
- This filterscript required SA-MP 0.3z+ and the lagcomp is on
- ==================================================
- */
- #include <a_samp>
- new TimesIn1Second[MAX_PLAYERS];
- new Timer[MAX_PLAYERS] = -1;
- public OnPlayerConnect(playerid)
- {
- TimesIn1Second[playerid] = 0;
- Timer[playerid] = SetTimerEx("CleanTimes",1000,true,"i",playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- TimesIn1Second[playerid] = 0;
- KillTimer(Timer[playerid]);
- Timer[playerid] = -1;
- return 1;
- }
- forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- if (weaponid != 38) TimesIn1Second[playerid] += 1;
- return 1;
- }
- forward CleanTimes(playerid);
- public CleanTimes(playerid)
- {
- if (TimesIn1Second[playerid] != 0)
- {
- if (TimesIn1Second[playerid] >= 60)
- {
- new msg[256];
- format(msg,sizeof(msg),"[Anti-Cheat]: [%d]%s has been kicked. Reason: Ammo-spam[%d/s]",playerid, GetPlayerNameEx(playerid), TimesIn1Second[playerid]);
- SendClientMessageToAll(0xFF0000,msg);
- print(msg);
- SetTimerEx("KickEx",100,false,"i",playerid);
- }
- TimesIn1Second[playerid] = 0;
- }
- }
- forward KickEx(playerid);
- public KickEx(playerid)
- {
- Kick(playerid);
- return 1;
- }
- stock GetPlayerNameEx(playerid)
- {
- new name[256];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment