Spam anti cheat
#1

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;

Reply
#2

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

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.
Reply
#4

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

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;
}
Reply
#6

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;

Reply
#7

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;
}
Reply
#8

That will stop the spam?
Reply
#9

yes it will
try it in game
Reply
#10

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

And the other things u have added?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)