SA-MP Forums Archive
Spam anti cheat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spam anti cheat (/showthread.php?tid=558379)



Spam anti cheat - Glossy42O - 16.01.2015

When i shot minigun it says [ANTI-CHEAT]: %s has been banned etc..

It spams when i shot everyshot i get a message

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
   new 
name[MAX_PLAYER_NAME], str[128];
   
GetPlayerName(playeridname,sizeof(name));
   
format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s has been banned by the server - Reason: Minigun",name);
   
SendClientMessageToAll(-1str);
   
SetTimerEx("ban"1000false"i"playerid);
   return 
1;
}
forward ban(playerid);
public 
ban(playerid)
{
  
SendClientMessage(playerid, -1"{FF0000}[BOT]: You have been banned for using minigun.");
  
SendClientMessage(playerid, -1"{FF0000}[BOT]: If you have been banned by mistake, Please post a ban appeal at www.website.com");
  
Ban(playerid);
  return 
1;




Re: Spam anti cheat - Jefff - 16.01.2015

pawn Код:
if(weaponid == WEAPON_MINIGUN)
{
// code here !
return 0;
}



Re: Spam anti cheat - RedFusion - 16.01.2015

By the way.. You're supposed to send the message first and then delay the ban. Otherwise the user won't see the message in time before the ban.


Re: Spam anti cheat - Glossy42O - 16.01.2015

I see the message, everything works but. 1 shot 1 message 9999 shots 9999 messages.


Re: Spam anti cheat - JonathanFeitosa - 17.01.2015

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
   if(weaponid == WEAPON_MINIGUN && hittype == BULLET_HIT_TYPE_PLAYER)
   {
        new name[MAX_PLAYER_NAME], str[128];
        GetPlayerName(playerid, name,sizeof(name));
        format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s has been banned by the server - Reason: Minigun",name);
        SendClientMessageToAll(-1, str);
        SendClientMessage(playerid, -1, "{FF0000}[BOT]: You have been banned for using minigun.");
        SendClientMessage(playerid, -1, "{FF0000}[BOT]: If you have been banned by mistake, Please post a ban appeal at www.website.com");
        Ban(playerid);
   }
   return 1;
}



Re: Spam anti cheat - Glossy42O - 17.01.2015

spam, i made new code
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
   if(
weaponid == WEAPON_MINIGUN && hittype == BULLET_HIT_TYPE_PLAYER)
   {
       new 
name[MAX_PLAYER_NAME], str[128];
       
GetPlayerName(playeridname,sizeof(name));
       
format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s has been banned by the server - Reason: Minigun",name);
       
SendClientMessageToAll(-1str);
       
SetTimerEx("ban"1000false"i"playerid);
   }
   return 
1;
}
forward ban(playerid);
public 
ban(playerid)
{

  
SendClientMessage(playerid, -1"{FF0000}[BOT]: You have been banned for using minigun.");
  
SendClientMessage(playerid, -1"{FF0000}[BOT]: If you have been banned by mistake, Please post a ban appeal at www.website.com");
  
Ban(playerid);
  return 
1;




Re: Spam anti cheat - BroZeus - 17.01.2015

like this
pawn Код:
new pInBan[MAX_PLAYERS];//on top

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
   if(weaponid == WEAPON_MINIGUN && hittype == BULLET_HIT_TYPE_PLAYER)
   {
       if(pInBan[playerid] == 1)return 0;//added this
       pInBan[playerid] = 1;//added this
       new name[MAX_PLAYER_NAME], str[128];
       GetPlayerName(playerid, name,sizeof(name));
       format(str,sizeof(str), "{FF0000}[ANTI-CHEAT]: %s has been banned by the server - Reason: Minigun",name);
       SendClientMessageToAll(-1, str);
        SendClientMessage(playerid, -1, "{FF0000}[BOT]: You have been banned for using minigun.");
        SendClientMessage(playerid, -1, "{FF0000}[BOT]: If you have been banned by mistake, Please post a ban appeal at www.website.com");
       SetTimerEx("ban", 1000, false, "i", playerid);
   }
   return 1;
}
forward ban(playerid);
public ban(playerid)
{
  Ban(playerid);
  pInBan[playerid] = 0;//added this
  return 1;
}



Re: Spam anti cheat - Glossy42O - 17.01.2015

That will stop the spam?


Re: Spam anti cheat - BroZeus - 17.01.2015

yes it will
try it in game


Re: Spam anti cheat - Glossy42O - 17.01.2015

Could u atleast explain those if(pInBan[playerid] == 1)return 0

And the other things u have added?