View Single Post
Old 15/07/2019, 06:10 PM   #1
OstGot's Avatar
Join Date: Mar 2013
Location: Gomel, Belarus
Posts: 865
Reputation: 325
Default SDiag - automatic diagnostics of frequent problems when the server starts


This include is intended to diagnose frequently encountered problems, many of which often appear through negligence. The script checks some conditions and then displays the corresponding warnings in the console and the server log.

Important note: this script only detects problems, but does not fix them on its own!

Currently it can detect the following problems:
  • Missing FILTERSCRIPT define in filterscripts (it's needed for many includes to work correctly)
  • Mismatch of MAX_PLAYERS macro and actual player slots on the server
  • GetTickCount overflow due to long continuous physical server operation
  • Outdated version of default SA-MP includes in relation to version of the server executable file (checks for 0.3.7, 0.3.7-R2, 0.3.7-R3 and 0.3.DL)
  • Absence of the scriptfiles folder or lack of access to it (it's needed for some scripts to work correctly)
  • Invalid maxnpc value in server.cfg when it exceeds the maximum player slots number on the server
  • Low sleep values in server.cfg, which can highly affect the accuracy of timers
  • Disabled query in server.cfg, which makes the server invisible for SA-MP launcher

Nothing complicated. Just download the script from one of the links below, move it to pawno/include folder and add to all filterscripts and gamemode by this way:
PHP Code:
#include <sdiag> 
and then recompile them.

How to use
When you turn the server on, a number of warnings will appear in the console if any problems are detected. Warnings in the gamemode are marked as "[SDiag: GM]" and "[SDiag: FS]" in filterscripts. Include doesn't have information about the name of the filterscript in which it detects a problem, but it's easy to understand in which filterscript it's occurred as after the warning you will see a message about the successful loading of that filterscript (before which the problem occurred).

v1.1: MediaFire Pastebin

Warnings description
Below is an explanation and description of all the warnings that this script displays:

HTML Code:
One of your filterscripts doesn't have FILTERSCRIPT define
This warning occurs when one of your filterscripts doesn't have the "#define FILTERSCRIPT" code at the very beginning. Just add it and don't neglect it henceforth, because many includes change their behavior depending on whether they are included to a filterscript or gamemode.

HTML Code:
Your MAX_PLAYERS define isn't equal to the real number of player slots
This means that the value of the MAX_PLAYERS macro in one of your scripts doesn't match with the value of real player slots set in server.cfg. Discrepancy of these values can lead to "array index out of bounds" runtime errors with arrays that use MAX_PLAYERS as one of their dimensions.

HTML Code:
GetTickCount is less than 0. Please restart your computer
Occurs when your physical server (computer) runs continuously for several weeks, causing GetTickCount to overflow (takes negative values). In this case you just need to restart the computer (if turning off and then turning on doesn't help, then you need to exactly restart it).

HTML Code:
The SA-MP includes version doesn't match with the server version. Please update them
It means that the default SA-MP includes outdated in relation to the version of the server that is currently running. Just update your includes by downloading samp-server archive from the official site with the necessary version of the server and includes.

HTML Code:
Your scriptfiles folder isn't created or you don't have access to it (some scripts may not work correctly)
This occurs when you don't have the "scriptfiles" folder, which should be located in the folder with the server. It may also occur if you don't have access to it. In this case (in case of its absence) create it or (if it has already been created) contact the hosting technical support/configure access rights yourself. Some scripts save their data here and they cannot create this folder on their own.

HTML Code:
The variable 'maxnpc' exceeds the maximum number of player slots
This means that the value of the 'maxnpc' variable (the maximum number of NPC bots that can enter the server) in server.cfg exceeds the value of real player slots also set in server.cfg.

HTML Code:
The variable 'sleep' is less than the default value. Your timers may work less accurately
Occurs when the value of the 'sleep' variable in server.cfg is less than its default value (5). At lower values of this variable, timers created via SetTimer/SetTimerEx become less accurate being called with longer delays.

HTML Code:
Query is disabled. Your server will not be visible in masterlist
Indicates that the query variable in server.cfg is disabled. Query mechanism is responsible for sending the server name, the number of players on it and other data that the client sees in the server list before entering the game.

You can also suggest your ideas to add to this script. Perhaps there are still some frequent problems that you are already tired of encountering finding them manually each time? So share it.
aka Nexius
Don't want to always check for updates of my scripts?
Include it the last, after all others
Nexius's Update Checker

Last edited by OstGot; 08/11/2019 at 12:38 PM. Reason: v1.1
OstGot is offline   Reply With Quote