diff --git a/PTWS.ini b/PTWS.ini index 3acf61f..2be1fe7 100644 --- a/PTWS.ini +++ b/PTWS.ini @@ -1,6 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; PTWS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[isKnownPTWSID] +SQL1_1 = SELECT CASE WHEN EXISTS(SELECT DateID FROM ptws WHERE DateID = ?) THEN 'true' ELSE 'false' END +Number Of Inputs = 1 +SQL1_INPUTS = 1 +OUTPUT = 1 [createDate] SQL1_1 = INSERT INTO ptws SET DateID = ? diff --git a/PTWS_x64.ini b/PTWS_x64.ini new file mode 100644 index 0000000..b75a6c0 --- /dev/null +++ b/PTWS_x64.ini @@ -0,0 +1,29 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; PTWS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +[isKnownPTWSID] +SQL1_1 = SELECT CASE WHEN EXISTS(SELECT DateID FROM ptws WHERE DateID = ?) THEN 'true' ELSE 'false' END +SQL1_INPUTS = 1 +OUTPUT = 1 + +[createDate] +SQL1_1 = INSERT INTO ptws SET DateID = ? +SQL1_INPUTS = 1 + +[getDate] +SQL1_1 = SELECT date FROM ptws WHERE DateID = ? +SQL1_INPUTS = 1 +OUTPUT = 1 + +[getWeather] +SQL1_1 = SELECT weather FROM ptws WHERE DateID = ? +SQL1_INPUTS = 1 +OUTPUT = 1 + +[setDate] +SQL1_1= UPDATE ptws SET date = ? WHERE DateID = ? +SQL1_INPUTS = 1,2 + +[setWeather] +SQL1_1= UPDATE ptws SET weather = ? WHERE DateID = ? +SQL1_INPUTS = 1,2 diff --git a/README.md b/README.md index 6716f3d..2cd9050 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ PTWS is a script made for Exile that allows time and weather to persist through 2) You should now have a ptws table. -3) Copy the contents of `PTWS.ini` into your `@ExileServer\extDB\sql_custom_v2\exile.ini` file at the bottom. +3) For 32bit: Copy the contents of `PTWS.ini` into your `@ExileServer\extDB\sql_custom_v2\exile.ini` file at the bottom. +3) For 64bit: Copy the contents of `PTWS_x64.ini` into your `@extdb3\sql_custom\exile.ini` file at the bottom. ##### Server 1) Take either the PTWS.pbo or the file and put it in your `@ExileServer\addons`. Use the file if you want to configure the settings and pack it after you're done. diff --git a/Server Files/@ExileServer/addons/PTWS.pbo b/Server Files/@ExileServer/addons/PTWS.pbo index df6aa7d..cdd89bf 100644 Binary files a/Server Files/@ExileServer/addons/PTWS.pbo and b/Server Files/@ExileServer/addons/PTWS.pbo differ diff --git a/Server Files/@ExileServer/addons/PTWS/initServer.sqf b/Server Files/@ExileServer/addons/PTWS/initServer.sqf index 9f46489..7347a2e 100644 --- a/Server Files/@ExileServer/addons/PTWS/initServer.sqf +++ b/Server Files/@ExileServer/addons/PTWS/initServer.sqf @@ -11,7 +11,12 @@ diag_log "PTWS - Initialized"; // Start PTWS - []execVM "\PTWS\scripts\insertPTWS.sqf"; + //DonkeyPunch - DirtySanchez add database check for known ID if none then populate it with config setup information + _isKnownPTWSDateID = format ["isKnownPTWSID:%1", PTWS_ID] call ExileServer_system_database_query_selectSingleField; + if!(_isKnownPTWSDateID)then + { + _insertPTWSDateID = format["createDate:%1", PTWS_ID] call ExileServer_system_database_query_insertSingle; + }; sleep 1; []execVM "\PTWS\scripts\startPTWS.sqf"; }; diff --git a/Server Files/@ExileServer/addons/PTWS/scripts/insertPTWS.sqf b/Server Files/@ExileServer/addons/PTWS/scripts/insertPTWS.sqf index 7ec9b37..67fb3dc 100644 --- a/Server Files/@ExileServer/addons/PTWS/scripts/insertPTWS.sqf +++ b/Server Files/@ExileServer/addons/PTWS/scripts/insertPTWS.sqf @@ -5,8 +5,8 @@ _checkDatabaseID = profileNamespace getVariable ["PTWS_DatabaseID",false]; if !(_checkDatabaseID isEqualTo PTWS_ID) then { -profileNamespace setVariable ["PTWS_DatabaseID",PTWS_ID]; -saveProfileNamespace; -_insertDatabaseID = format["createDate:%1", PTWS_ID] call ExileServer_system_database_query_insertSingle; -_insertDatabaseID; + profileNamespace setVariable ["PTWS_DatabaseID",PTWS_ID]; + saveProfileNamespace; + _insertDatabaseID = format["createDate:%1", PTWS_ID] call ExileServer_system_database_query_insertSingle; + _insertDatabaseID; }; \ No newline at end of file diff --git a/Server Files/@ExileServer/addons/PTWS/scripts/startPTWS.sqf b/Server Files/@ExileServer/addons/PTWS/scripts/startPTWS.sqf index 4139b2e..dd4b7a4 100644 --- a/Server Files/@ExileServer/addons/PTWS/scripts/startPTWS.sqf +++ b/Server Files/@ExileServer/addons/PTWS/scripts/startPTWS.sqf @@ -3,7 +3,7 @@ if (!isServer) exitWith {}; _saveddate = format ["getDate:%1", PTWS_ID] call ExileServer_system_database_query_selectSingleField; _savedWeather = format ["getWeather:%1", PTWS_ID] call ExileServer_system_database_query_selectSingleField; - +diag_log format["PTWSDebug:db data - date:%1 weather:%2",_saveddate,_savedWeather]; if (typeName _saveddate isEqualTo "ARRAY") then { diag_log format["PTWS - Loading last saved date : %1", _saveddate];