Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SDiag by Nexius v1.1
- #if defined _sdiag_included
- #endinput
- #endif
- #define _sdiag_included
- #include <a_samp>
- #define SDIAG_VERSION "1.1"
- enum wMode
- {
- WARNING_MODE_GM,
- WARNING_MODE_FS
- }
- static const WarningMode[wMode][] =
- {
- "[SDiag: GM] ",
- "[SDiag: FS] "
- };
- enum wMessage
- {
- NO_FILTERSCRIPT_DEFINE,
- WRONG_MAX_PLAYERS_DEFINE,
- INCLUDE_VERSION_MISMATCH,
- NEGATIVE_TICK_COUNT,
- NO_SCRIPTFILES_FOLDER,
- WRONG_MAXNPC_VALUE,
- LOW_SLEEP_VALUE,
- QUERY_IS_DISABLED
- }
- static const WarningMessage[wMessage][] =
- {
- "One of your filterscripts doesn't have FILTERSCRIPT define",
- "Your MAX_PLAYERS define isn't equal to the real number of player slots",
- "The SA-MP includes version doesn't match with the server version. Please update them",
- "GetTickCount is less than 0. Please restart your computer",
- "Your scriptfiles folder isn't created or you don't have access to it (some scripts may not work correctly)",
- "The variable 'maxnpc' exceeds the maximum number of player slots",
- "The variable 'sleep' is less than the default value. Your timers may work less accurately",
- "Query is disabled. Your server will not be visible in masterlist"
- };
- static bool:sdiag_IsFilterscript;
- public OnFilterScriptInit()
- {
- sdiag_IsFilterscript = true;
- #if !defined FILTERSCRIPT
- sdiag_SendWarning(NO_FILTERSCRIPT_DEFINE);
- #endif
- if(MAX_PLAYERS != GetMaxPlayers()) sdiag_SendWarning(WRONG_MAX_PLAYERS_DEFINE);
- new strtmp[10];
- GetServerVarAsString("version", strtmp, sizeof strtmp);
- if(strfind(strtmp, "0.3.7") != -1)
- {
- #if !defined OnVehicleSirenStateChange
- sdiag_SendWarning(INCLUDE_VERSION_MISMATCH);
- #else
- if(!strcmp(strtmp, "0.3.7-R2") || !strcmp(strtmp, "0.3.7-R3"))
- {
- #if !defined GetConsoleVarAsInt
- sdiag_SendWarning(INCLUDE_VERSION_MISMATCH);
- #endif
- }
- #endif
- }
- else if(strfind(strtmp, "0.3.DL") != -1)
- {
- #if !defined GetPlayerCustomSkin
- sdiag_SendWarning(INCLUDE_VERSION_MISMATCH);
- #endif
- }
- #if defined sdiag_OnFilterScriptInit
- return sdiag_OnFilterScriptInit();
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnFilterScriptInit
- #undef OnFilterScriptInit
- #else
- #define _ALS_OnFilterScriptInit
- #endif
- #define OnFilterScriptInit sdiag_OnFilterScriptInit
- #if defined sdiag_OnFilterScriptInit
- forward sdiag_OnFilterScriptInit();
- #endif
- public OnGameModeInit()
- {
- if(!sdiag_IsFilterscript)
- {
- if(GetTickCount() < 0) sdiag_SendWarning(NEGATIVE_TICK_COUNT);
- if(MAX_PLAYERS != GetMaxPlayers()) sdiag_SendWarning(WRONG_MAX_PLAYERS_DEFINE);
- new strtmp[10];
- GetServerVarAsString("version", strtmp, sizeof strtmp);
- if(strfind(strtmp, "0.3.7") != -1)
- {
- #if !defined OnVehicleSirenStateChange
- sdiag_SendWarning(INCLUDE_VERSION_MISMATCH);
- #else
- if(!strcmp(strtmp, "0.3.7-R2") || !strcmp(strtmp, "0.3.7-R3"))
- {
- #if !defined GetConsoleVarAsInt
- sdiag_SendWarning(INCLUDE_VERSION_MISMATCH);
- #endif
- }
- #endif
- }
- else if(strfind(strtmp, "0.3.DL") != -1)
- {
- #if !defined GetPlayerCustomSkin
- sdiag_SendWarning(INCLUDE_VERSION_MISMATCH);
- #endif
- }
- new File:fhandle = fopen("sdiag_testfile.txt");
- if(!fhandle) sdiag_SendWarning(NO_SCRIPTFILES_FOLDER);
- else
- {
- fclose(fhandle);
- fremove("sdiag_testfile.txt");
- }
- if(GetServerVarAsInt("maxnpc") > GetMaxPlayers()) sdiag_SendWarning(WRONG_MAXNPC_VALUE);
- if(GetServerVarAsInt("sleep") < 5) sdiag_SendWarning(LOW_SLEEP_VALUE);
- if(GetServerVarAsBool("query") != 1) sdiag_SendWarning(QUERY_IS_DISABLED);
- }
- #if defined sdiag_OnGameModeInit
- return sdiag_OnGameModeInit();
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit sdiag_OnGameModeInit
- #if defined sdiag_OnGameModeInit
- forward sdiag_OnGameModeInit();
- #endif
- static sdiag_SendWarning(wMessage:warnid)
- {
- if(sdiag_IsFilterscript) printf("%s%s", WarningMode[WARNING_MODE_FS], WarningMessage[warnid]);
- else printf("%s%s", WarningMode[WARNING_MODE_GM], WarningMessage[warnid]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement