SA-MP Forums Archive
SendClientMessage Spam - 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: SendClientMessage Spam (/showthread.php?tid=599254)



SendClientMessage Spam - lulo356 - 23.01.2016

My Warning system is spamming the chat, but i don't know why,

PHP код:
stock ServerBan(playeridReason[])
{
    new 
string[128];
    
format(stringsizeof(string), "[%s] %s Might be hacking, Reason: %s"date(gettime()+36009), RPName(playerid), Reason);
    
SendToAdmins(YELLOWstring);
    return 
1;




Re: SendClientMessage Spam - LetsOWN[PL] - 23.01.2016

Show the body of
pawn Код:
SendToAdmins(x,y)



Re: SendClientMessage Spam - lulo356 - 23.01.2016

PHP код:
public SendToAdmins(colourstring[])
{
    for(new 
0MAX_PLAYERSi++)
    {
          if(
IsPlayerConnectedEx(i))
          {
              if(
AdminLoggedIn[i] == && Player[i][Adminlevel] >= 1)
              {
                  
SendClientMessage(icolourstring);
               }
        }
    }
    return 
1;




Re: SendClientMessage Spam - xTURBOx - 23.01.2016

where in your script are you using ServerBan(playerid,reason)?


Re: SendClientMessage Spam - LetsOWN[PL] - 23.01.2016

Quote:
Originally Posted by lulo356
Посмотреть сообщение
PHP код:
public SendToAdmins(colourstring[])
{
    for(new 
0MAX_PLAYERSi++)
    {
          if(
IsPlayerConnectedEx(i))
          {
              if(
AdminLoggedIn[i] == && Player[i][Adminlevel] >= 1)
              {
                  
SendClientMessage(icolourstring);
               }
        }
    }
    return 
1;

Well, this function is not spaming itself.
When ServerBan is called? If it is called in frequently called callback (however that sounds like) consider something like this.

Let lastWarningSent[MAX_PLAYERS] be the variable to hold timestamp of last warning sent.

Let's assume your ServerBan command is called this way:
pawn Код:
public OnPlayerUpdate(playerid){
  if(isPlayerCheating(playerid)) ServerBan(0, "cheating");
}
As you can see, isPlayerCheating would eventually return 1 every time it is called. That's why it might call ServerBan function so often. Therefore, try something like this:
pawn Код:
public OnPlayerUpdate(playerid) {
  if(isPlayerCheating(playerid)) {
    if(lastWarningSent[playerid] < gettime()) {
      ServerBan(playerid, "cheater");
      lastWarningSent[playerid] = gettime() + howmanyseconds;
    }
  }
}
Now, even if isPlayerCheating returns 1, it will not call ServerBan() until some time lapses.
Of course, if you would like to handle more cases that ServerBan is called, then you'll have to reconsider entire strategy with lastWarningSent thing. I just wanted to give you an idea. Maybe it will appear helpfull.




Re: SendClientMessage Spam - Prokill911 - 23.01.2016

Quote:
Originally Posted by lulo356
Посмотреть сообщение
PHP код:
public SendToAdmins(colourstring[])
{
    for(new 
0MAX_PLAYERSi++)
    {
          if(
IsPlayerConnectedEx(i))
          {
              if(
AdminLoggedIn[i] == && Player[i][Adminlevel] >= 1)
              {
                  
SendClientMessage(icolourstring);
               }
        }
    }
    return 
1;

Can't tell if you're being serious or not..
You're wondering why it's spamming?

your "SendToAdmins"
Counts Every player that's in the server..
Then If there's an admin on it sends the message for max players.

PHP код:
public SendToAdmins(color, const string[]) {
    foreach(
Playeri) {
        if(
IsPlayerConnectedEx(i)) {
            if(
AdminLoggedIn[i] == && Player[i][Adminlevel] >= 1) {
                
SendClientMessage(icolormsg);
            }
        }
    }

Fixed above..


Re: SendClientMessage Spam - PrO.GameR - 23.01.2016

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
Can't tell if you're being serious or not..
You're wondering why it's spamming?

your "SendToAdmins"
Counts Every player that's in the server..
Then If there's an admin on it sends the message for max players.

PHP код:
public SendToAdmins(color, const string[]) {
    foreach(
Playeri) {
        if(
IsPlayerConnectedEx(i)) {
            if(
AdminLoggedIn[i] == && Player[i][Adminlevel] >= 1) {
                
SendClientMessage(icolormsg);
            }
        }
    }

Fixed above..
Now I'm not sure if YOU are serious or just doesn't know anything about scripting..
His code is perfectly fine, it doesn't count shit and just sends the msg to admins.
He just sends too many ServerBan calls in his anti-cheat script instead of one, as people mentioned above, best way to prevent it is to flag player after sending first msg so next ones won't be send.


Re: SendClientMessage Spam - Prokill911 - 23.01.2016

I don't know shit?
Yet I have a degree in computer science with a major in programming languages..
Okay for sure.


Re: SendClientMessage Spam - Vince - 23.01.2016

Oh, boasting with degrees. Yet PrO.GameR is actually right.


Re: SendClientMessage Spam - Pottus - 23.01.2016

I'll tell you the problem, the problem is this donkey just downloads gamemodes and has absolutely no idea what the hell he is doing with them at all.