Register

DonkeyPunch Community Gaming

GAME ON!!! -sTanG

News:

Spring 2017 is here and the weather is getting better, expect fast updates to happen over the next few weeks. Many surprises to come.
Administrator
*****

DirtySanchez

January 14, 2016, 05:04:19 AM
Humanitarian Posts: 932 Humanity: +1337/-420
Added a second expanded logging within exile!


This one is perfect for server owners, so far its only on persistant vehicles. It would work to get this on all, but what a log that might become.


So this will log,
1. vehicle ID, allowing for full tracking of all vehicles in and out of DB.
2. vehicle owner UID.
3. vehicle class.
4. vehicle last position x, y, z.
5. killer name
6. killer UID
7. timestamp


instructions to come shortly


ExileServer_object_vehicle_event_onMPKilled.sqf
Code: [Select]

/**
 * ExileServer_object_vehicle_event_onMPKilled
 *
 * Exile Mod
 * www.exilemod.com
 *
*
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */

private["_vehicleObject"];
if !(isServer) exitWith {true};
_vehicleObject = _this select 0;
_killer = _this select 1;
_vehicleClass = typeOf _vehicleObject;
_vehicleID = _vehicleObject getVariable ["ExileDatabaseID", -1];
_data = format ["loadVehicle:%1", _vehicleID] call ExileServer_system_database_query_selectSingle;
_class = _data select 1;
_vehOwner = _data select 3;
_kName = name _killer;
_kUID = getPlayerUID _killer;
_vehiclePosition = getPos _vehicleObject;
if (_vehicleObject getVariable ["ExileIsPersistent", false]) then
{
 diag_log format["%1:%2:%3:%4:%5:%6:%7:%8", _vehicleID, _vehOwner, _vehicleClass, _vehiclePosition select 0, _vehiclePosition select 1, _vehiclePosition select 2, _kName, _kUID];
 format["insertVehicleHistory:%1:%2:%3:%4:%5:%6:%7:%8", _vehicleID, _vehOwner, _vehicleClass, _vehiclePosition select 0, _vehiclePosition select 1, _vehiclePosition select 2, _kName, _kUID] call ExileServer_system_database_query_fireAndForget;
};
_vehicleObject call ExileServer_object_vehicle_remove;
_vehicleObject setVariable ["ExileDiedAt", time];
true

exile.ini
Code: [Select]
[insertVehicleHistory]
SQL1_1 = INSERT INTO vehicle_history SET id = ?, owner = ?, class = ?, position_x = ?, position_y = ?, position_z = ?, killer = ?, kUID = ?
Number Of Inputs = 8
SQL1_INPUTS = 1,2,3-STRING,4,5,6,7,8
Code: [Select]
MySQL query on your current database
CREATE TABLE `vehicle_history` (
 `id` varchar(32) NOT NULL,
 `owner` varchar(64) NOT NULL,
 `class` varchar(64) NOT NULL,
 `position_x` double NOT NULL DEFAULT '0',
   `position_y` double NOT NULL DEFAULT '0',
   `position_z` double NOT NULL DEFAULT '0',
   `killer` varchar(64) NOT NULL,
   `kUID` varchar(32) NOT NULL,
   `destroyed_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
« Last Edit: April 01, 2017, 12:10:48 AM by DirtySanchez »


Website: http://DonkeyPunch.INFO  |  Discord: https://discord.me/eXpoch  |  TeamSpeak: ts3.donkeypunch.info


 
1337-420