SendClientMessage Spam -
lulo356 - 23.01.2016
My Warning system is spamming the chat, but i don't know why,
PHP код:
stock ServerBan(playerid, Reason[])
{
new string[128];
format(string, sizeof(string), "[%s] %s Might be hacking, Reason: %s", date(gettime()+3600, 9), RPName(playerid), Reason);
SendToAdmins(YELLOW, string);
return 1;
}
Re: SendClientMessage Spam -
LetsOWN[PL] - 23.01.2016
Show the body of
Re: SendClientMessage Spam -
lulo356 - 23.01.2016
PHP код:
public SendToAdmins(colour, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i))
{
if(AdminLoggedIn[i] == 1 && Player[i][Adminlevel] >= 1)
{
SendClientMessage(i, colour, string);
}
}
}
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(colour, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i))
{
if(AdminLoggedIn[i] == 1 && Player[i][Adminlevel] >= 1)
{
SendClientMessage(i, colour, string);
}
}
}
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(colour, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i))
{
if(AdminLoggedIn[i] == 1 && Player[i][Adminlevel] >= 1)
{
SendClientMessage(i, colour, string);
}
}
}
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(Player, i) {
if(IsPlayerConnectedEx(i)) {
if(AdminLoggedIn[i] == 1 && Player[i][Adminlevel] >= 1) {
SendClientMessage(i, color, msg);
}
}
}
}
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(Player, i) {
if(IsPlayerConnectedEx(i)) {
if(AdminLoggedIn[i] == 1 && Player[i][Adminlevel] >= 1) {
SendClientMessage(i, color, msg);
}
}
}
}
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.