SA-MP Forums Archive
How can I prevent detection spamming [REP+] - 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: How can I prevent detection spamming [REP+] (/showthread.php?tid=589528)



How can I prevent detection spamming [REP+] - SecretBoss - 20.09.2015

Hello again,

I have a callback that it is called when a cheat is detected but for example if I am alerting an admin on this callback the chat is getting spammed with the same message, ex. if a player is airbraking it will say

Код:
SecretBoss(0) suspected using Airbrake hacks
SecretBoss(0) suspected using Airbrake hacks
SecretBoss(0) suspected using Airbrake hacks
SecretBoss(0) suspected using Airbrake hacks
SecretBoss(0) suspected using Airbrake hacks
SecretBoss(0) suspected using Airbrake hacks
SecretBoss(0) suspected using Airbrake hacks
many times.

Is there any way to make the message to be sent just one time? Thanks for reading, and help will be appreciated and SecretBoss(0) suspected using Airbrake hacks


Re: How can I prevent detection spamming [REP+] - TommyB - 20.09.2015

Make a variable and set it to true when a player is suspected of cheating. While it's set to true, don't alert the admins.


Re: How can I prevent detection spamming [REP+] - SecretBoss - 20.09.2015

Quote:
Originally Posted by TommyB
Посмотреть сообщение
Make a variable and set it to true when a player is suspected of cheating. While it's set to true, don't alert the admins.
And if the player will hack another time?


Re: How can I prevent detection spamming [REP+] - BroZeus - 20.09.2015

Set a timer to set it to false again.
EDIt: The solution posted down is better.


Re: How can I prevent detection spamming [REP+] - karemmahmed22 - 20.09.2015

It can be done with GetTickCount, And variable.
Heres an example
PHP код:
new TickCount[MAX_PLAYERS];
//OnPlayerConnect :-
TickCount[playerid] = 0;
//OnPlayerSuspectedForAirbreak or w/e the callback is :D
if(TickCount[playerid] < GetTickCount())
{
 
TickCount[playerid] = GetTickCount() + 120000// Some time
 //Warn Here.
 
return 1;
}
else if(
TickCount[playerid] > GetTickCount()) return 1//no warnings. 
Its will warn every few mins if player still airbreaking, it wont spam the chat
P.S.:I didn't test it so, you can test me and tell me if theres something wrong.


Re: How can I prevent detection spamming [REP+] - SecretBoss - 20.09.2015

Quote:
Originally Posted by karemmahmed22
Посмотреть сообщение
It can be done with GetTickCount, And variable.
Heres an example
PHP код:
new TickCount[MAX_PLAYERS];
//OnPlayerConnect :-
TickCount[playerid] = 0;
//OnPlayerSuspectedForAirbreak or w/e the callback is :D
if(TickCount[playerid] < GetTickCount();)
{
 
TickCount[playerid] = GetTickCount() + 120000// Some time
 //Warn Here.
 
return 1;
}
else if(
TickCount[playerid] > GetTickCount()) return 1//no warnings. 
Its will warn every few mins if player still airbreaking, it wont spam the chat
P.S.:I didn't test it so, you can test me and tell me if theres something wrong.
Thanks for info, I repped you all for helping me but I have some errors, the problem is that it can't get tickcount I think have a look here

Код:
.pwn(707) : error 001: expected token: ")", but found ";"
.pwn(707) : error 036: empty statement
.pwn(707) : error 029: invalid expression, assumed zero
.pwn(707) : fatal error 107: too many error messages on one line
Error line is

Код:
if(TickCount[playerid] < GetTickCount();)
- EDIT -

Код:
if(TickCount[playerid] < GetTickCount())
You putted a ; that is was not needed, its working thanks for all guys