diff --git a/CMakeLists.txt b/CMakeLists.txt
index c57ed75..fec9b98 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16.0)
-project(gsclib VERSION 1.2.0 LANGUAGES C)
+project(gsclib VERSION 1.5.0 LANGUAGES C)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
diff --git a/README.md b/README.md
index afc7e65..a0e2e1a 100644
--- a/README.md
+++ b/README.md
@@ -21,11 +21,21 @@
* [Math](https://github.com/Iswenzz/gsclib/blob/master/docs/math.md)
## Instructions
-In order to use this library, just download the archived file down below, and extract it to the Call of Duty 4X ``plugins/gsclib`` directory.
+In order to use this library, you'll need to compile the binary and place it to the CoD4 ``plugins`` directory.
+Then you can simply use ``loadplugin gsclib`` in your ``server.cfg`` or as CLI arguments.
+
+To initialize gsclib library you need to call ``GSCLIB_Init()`` at the start of your mod entry point.
+
+```c
+main()
+{
+ GSCLIB_Init();
+}
+```
## Building (Linux)
_Pre-Requisites:_
-1. Edit plugin_handle.h then recompile the server with an empty obj directory:
+1. Edit plugin_handler.h then recompile the server with an empty obj directory:
```c
#define MAX_SCRIPTFUNCTIONS 256
```
diff --git a/conanfile.py b/conanfile.py
index a750392..7932bac 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -2,7 +2,7 @@
class gsclib(ConanFile):
name = "gsclib"
- version = "1.3.0"
+ version = "1.5.0"
license = "LICENCE"
url = "https://github.com/Iswenzz/gsclib"
description = "gsclib acts as a standard library extension for the Call of Duty 4 scripting language."
diff --git a/docs/system.md b/docs/system.md
index c49c83f..f2b7531 100644
--- a/docs/system.md
+++ b/docs/system.md
@@ -1,5 +1,16 @@
# System
+#### ``GSCLIB_Init()``
+Initialize gsclib library, this should be called at the start of your mod entry point.
+
+```c
+main()
+{
+ GSCLIB_Init();
+}
+```
+
+
#### ``System()``
Execute a system command.
diff --git a/src/plugin.c b/src/plugin.c
index 34f70e7..895ed1d 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -19,7 +19,23 @@
#include "utils/player.h"
#define FUNCTION(name, function) Plugin_ScrReplaceFunction(name, function)
-#define METHOD(name, function) Plugin_ScrReplaceMethod(name, function)
+#define METHOD(name, function) Plugin_ScrReplaceMethod(name, function)
+
+///
+/// Init gsclib library.
+///
+void Init()
+{
+ Plugin_Printf("[GSCLIB] Initialize\n");
+
+ AsyncHandlerRestart();
+ ShutdownCriticalSections();
+
+ MySQL_Working(qfalse);
+ HTTP_Working(qfalse);
+ FTP_Working(qfalse);
+ CURL_Working(qfalse);
+}
///
/// Plugin initialization.
@@ -30,6 +46,9 @@ PCL int OnInit()
curl_handler.code = curl_global_init(CURL_GLOBAL_ALL);
mysql_handler.code = mysql_library_init(0, NULL, NULL);
+ // gsclib
+ FUNCTION("gsclib_init", &Init);
+
// data/file
FUNCTION("file_create", &GScr_FILE_Create);
FUNCTION("file_open", &GScr_FILE_Open);
@@ -211,30 +230,6 @@ PCL int OnInit()
return 0;
}
-///
-/// Pre fast restart callback.
-///
-///
-PCL void OnPreFastRestart()
-{
- OnExitLevel();
-}
-
-///
-/// Exit level callback.
-///
-///
-PCL void OnExitLevel()
-{
- AsyncHandlerRestart();
- ShutdownCriticalSections();
-
- MySQL_Working(qfalse);
- HTTP_Working(qfalse);
- FTP_Working(qfalse);
- CURL_Working(qfalse);
-}
-
///
/// Plugin shutdown.
///
diff --git a/src/sys/system.c b/src/sys/system.c
index bf350f6..884226d 100644
--- a/src/sys/system.c
+++ b/src/sys/system.c
@@ -99,7 +99,7 @@ void GScr_EnterCriticalSection()
}
if (!section)
{
- Plugin_Scr_AddBool(qfalse);
+ Plugin_Scr_Error(fmt("EnterCriticalSection(): section %s not found.", name));
return;
}
if (!section->locked)
diff --git a/src/sys/system.h b/src/sys/system.h
index fa87e40..ec26ca4 100644
--- a/src/sys/system.h
+++ b/src/sys/system.h
@@ -4,7 +4,7 @@
#define MAXPRINTMSG 1024
#define GSCLIB_VERSION_MAJOR 1
-#define GSCLIB_VERSION_MINOR 4
+#define GSCLIB_VERSION_MINOR 5
///
/// Critical section/mutex struct.