Posted on April 20, 2018 at 13:06 (GMT +00:00) by
Colin
I finally got around to correcting some of the 64-bit code and some basic testing for my ArmaDB plugin for Arma 3 (see previous beta release
here)
ArmaDB is a plugin and interface to use mysql/mariadb from Arma 3 dedicated server on Windows, it is developed to allow easy integration, high performance and easy usage, you can use it for storing persistent data in your database, whether it is scores, money, inventories, containers or anything your imagination comes up with!
This version is bug tested, tuned and contains both libraries for 32-bit and 64-bit windows dedicated server, I am now ready to take suggestions/ideas from anyone wanting to use the library.
Download Plugin and Sample Mod here
Sample addon (posted from previous post, added here for ease of access)
//
// PXSample mod
//
#include "PX\mysql.sqf";
// init db ?
[] call mysql_init;
mydb = ['root', 'yourpassword', 'databasename', 'localhost', 3306] call mysql_connect;
addMissionEventHandler ["EntityRespawned", {
params ["_obj", "_old"];
private ["_result", "_resource", "_row", "_uid"];
if (isPlayer _obj) then {
_uid = getPlayerUID _obj;
_result = [mydb, "SELECT acc_uid FROM accounts WHERE acc_uid = '%1' LIMIT 1;", _uid] call mysql_query;
if (_result == "") then {
_resource = [mydb] call mysql_store_result;
if (!(_resource == "")) then {
_row = [_resource] call mysql_fetch_row;
if (count _row > 0) then {
// player exists already? do something maybe
} else {
[mydb, "INSERT INTO accounts(acc_uid, acc_clientname, acc_last_conn_dt) VALUES('%1','%2',NOW());", _uid, name _obj] call mysql_query;
};
};
[_resource] call mysql_free_result;
};
};
}];
Don't forget to drop me a comment and any suggestions below.