• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Server] Problem with GetTickCount
#1
I made an anti flood command script for my gamemode, in which the player can only type commands every 2 seconds. Everything worked fine, until yesterday I realized that this script had bugged, any command typed by the player regardless of the time between them is classified as spam.

[Image: xr701iO.png]

So I decided to do a type of debugging, to see what value the GetTickCount was returning, and it is returning very large negative values.
[Image: Palr2LS.png]

The amazing thing about this problem is that it only occurs on my computer, on my notebook and on the gamemode host this problem does not occur everything works correctly. Does anyone have any idea what this is? Maybe some problem with some windows dll? I do not believe it is a gamemode problem, because as I mentioned in other places it works normally, only on my computer this problem occurs.

Here are the plugins / includes I use and the anti flood code snippet
PHP Code:
#include? ? <a_samp>
#define FIXES_Single 1
#define FIXES_ServerVarMsg 0
#define LOCAL_HOST true
// Redefini??es antes da Fixes
#if? ? ? defined MAX_PLAYERS
#undef? ? MAX_PLAYERS
#if LOCAL_HOST == true
#define? MAX_PLAYERS? (100)
#else
#define? MAX_PLAYERS? (30)
#endif
#endif
//
#include <fixes>
#include <crashdetect>
#include? ? <timerfix>
#include? ? <a_mysql>
#include? ? <foreach>
#include? ? <izcmd>
#include? ? <sscanf2>
#include? ? <MV_Youtube>
#include? ? <streamer>
#include? ? <callbacks>
#include? ? <mSelection>
#define AUTO_SETUP
#include? ? <gmtime>


public OnPlayerCommandReceived(playeridcmdtext[])
{
? ? if (!
IsPlayerConnected(playerid) || playerid == INVALID_PLAYER_ID)
{
return 
SendClientMessage(playeridCOLOR_INVALID"You are not connected."), false;
}
if (
GetTickCount() - timeUsedCommand[playerid] < 2000)
? ? {
return 
SendClientMessage(playeridCOLOR_GRAD1"Wait 2 seconds to retype a command!"), false;
? ? }
timeUsedCommand[playerid] = GetTickCount();
? ? return 
1;


plugins crashdetect fixchars sscanf mysql streamer timerfix gmtime SAMPSON

And this problem has occurred with any code that uses the native GetTickCount.
  Reply


Messages In This Thread
Problem with GetTickCount - by RhaegarX - 2021-03-11, 12:55 PM
RE: Problem with GetTickCount - by Virsenas - 2021-03-11, 08:12 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 08:53 PM
RE: Problem with GetTickCount - by Virsenas - 2021-03-11, 08:55 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 08:57 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 09:08 PM
RE: Problem with GetTickCount - by Radical - 2021-03-11, 08:31 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 08:55 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 09:31 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 09:38 PM
RE: Problem with GetTickCount - by Virsenas - 2021-03-11, 10:02 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 10:06 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-11, 09:57 PM
RE: Problem with GetTickCount - by Y_Less - 2021-03-11, 11:18 PM
RE: Problem with GetTickCount - by RhaegarX - 2021-03-12, 01:17 AM
RE: Problem with GetTickCount - by Pinch - 2021-03-12, 11:51 AM
RE: Problem with GetTickCount - by rasheed - 2021-03-13, 08:40 AM
RE: Problem with GetTickCount - by Y_Less - 2021-03-13, 02:25 PM
RE: Problem with GetTickCount - by Pinch - 2021-03-13, 03:02 PM
RE: Problem with GetTickCount - by Y_Less - 2021-03-13, 05:36 PM
RE: Problem with GetTickCount - by Virsenas - 2021-03-13, 05:46 PM
RE: Problem with GetTickCount - by Pinch - 2021-03-13, 06:22 PM

Forum Jump: