diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 000000000..a1d6cd0d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,27 @@ +--- +name: Bug Report +about: Create a report to help us improve +title: '' +labels: Bug +assignees: Scarso327 + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/Client Side/Framework/Configuration/CfgSettings.hpp b/Client Side/Framework/Configuration/CfgSettings.hpp index 82cddfceb..e20fe2674 100644 --- a/Client Side/Framework/Configuration/CfgSettings.hpp +++ b/Client Side/Framework/Configuration/CfgSettings.hpp @@ -1,7 +1,7 @@ class CfgSettings { developers[] = { "76561198092567307", "76561197971322689" }; - framework_version = "1.1.2"; + framework_version = "1.1.3"; total_maxWeight = 5; diff --git a/Client Side/Framework/Functions/Tablet/Messaging/fn_messages.sqf b/Client Side/Framework/Functions/Tablet/Messaging/fn_messages.sqf index 24527b631..41d41d7ef 100644 --- a/Client Side/Framework/Functions/Tablet/Messaging/fn_messages.sqf +++ b/Client Side/Framework/Functions/Tablet/Messaging/fn_messages.sqf @@ -88,14 +88,14 @@ switch (lbCurSel _toolbox) do { }; if ((_display getVariable ["MessageRecievedEvent", -1]) isEqualTo -1) then { - ["MessageReceived", { + _display setVariable ["MessageRecievedEvent", (["MessageReceived", { private _display = findDisplay 23000; if (isNull _display && { !((lbCUrSel (_display displayCtrl 23036)) isEqualTo 1) }) exitWith { [_event, _eventId] call ULP_fnc_removeEventHandler; }; _display call ULP_fnc_messages; - }] call ULP_fnc_addEventHandler; + }] call ULP_fnc_addEventHandler)]; }; }; default { diff --git a/Client Side/Maps/AltisLife.Altis/mission.sqm b/Client Side/Maps/AltisLife.Altis/mission.sqm index 9005791db..f853f3827 100644 Binary files a/Client Side/Maps/AltisLife.Altis/mission.sqm and b/Client Side/Maps/AltisLife.Altis/mission.sqm differ diff --git a/README.md b/README.md index c0c9344a8..0ce95892e 100644 --- a/README.md +++ b/README.md @@ -119,8 +119,10 @@ A highly configurable mission developed with inspiration from a variety of ArmA ### Setting Up This is a very brief list of things you need to do to set up and play the mission. -* You need a database that supports MySQL to run the `altislife.sql` file found in `ServerSide/Database`. - - If you're updating from a previous version all database changes are included in `ServerSide/Database/Migrations`. +* You need a database that supports MySQL 8.0.13 or later to run the `altislife_mysql_8_0_13.sql` file found in `ServerSide/Database`. + - You must use mysql_native_password for the user as EXTDB3 doesn't support the new security stuff. + - The version is set as that's what we've developed with so can ensure support, others might work but if you encounter issues please switch. + - If you're updating from a previous version all database changes are included in `ServerSide/Database/Migrations`. These might also be setup for older syntax * A setup and ready-to-go ArmA 3 Server on at least version 2.02 for HashMap support. - Startup parameters for server `-servermod=@life_server;@extDB3` diff --git a/Server Side/altislife_mysql_8_0_13.sql b/Server Side/altislife_mysql_8_0_13.sql new file mode 100644 index 000000000..5095dea06 --- /dev/null +++ b/Server Side/altislife_mysql_8_0_13.sql @@ -0,0 +1,403 @@ + +-- Dumping database structure for altislife +CREATE DATABASE IF NOT EXISTS `altislife` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */; +USE `altislife`; + +-- Dumping structure for procedure altislife.deleteOldElection + + +CREATE PROCEDURE IF NOT EXISTS `deleteOldElection`() +BEGIN + DELETE FROM votes WHERE `active`='0'; + DELETE FROM candidates WHERE `active`='0'; +END; + + +-- Dumping structure for procedure altislife.deleteOldBaseBids + +CREATE PROCEDURE IF NOT EXISTS `deleteOldBaseBids`() +BEGIN + DELETE FROM base_bids WHERE `active`='0'; +END; + + +-- Dumping structure for procedure altislife.deleteOldMail + +CREATE PROCEDURE IF NOT EXISTS`deleteOldMail`() +BEGIN + DELETE FROM mail WHERE claimed='1'; +END; + + +-- Dumping structure for procedure altislife.deleteOldGroups + +CREATE PROCEDURE IF NOT EXISTS`deleteOldGroups`() +BEGIN + DELETE FROM `groups` WHERE `active`='0'; +END; + + +-- Dumping structure for procedure altislife.deleteOldHouses + +CREATE PROCEDURE IF NOT EXISTS `deleteOldHouses`() +BEGIN + DELETE FROM houses WHERE sold='1'; +END; + + +-- Dumping structure for procedure altislife.deleteOldWarrants + +CREATE PROCEDURE IF NOT EXISTS `deleteOldWarrants`() +BEGIN + DELETE FROM warrants WHERE `active`='0'; +END; + + + +CREATE PROCEDURE IF NOT EXISTS`deleteOldCommunityGoals`() +BEGIN + DELETE FROM community_goals WHERE end_date <= CURDATE(); +END; + + +-- Dumping structure for procedure altislife.resetDailyGoals + +CREATE PROCEDURE IF NOT EXISTS `resetDailyGoals`() +BEGIN + UPDATE players SET cop_daily_tasks = '"[]"'; + UPDATE players SET med_daily_tasks = '"[]"'; + UPDATE players SET hato_daily_tasks = '"[]"'; + UPDATE players SET civ_daily_tasks = '"[]"'; + UPDATE settings SET `value`=DATE_FORMAT(CURDATE(), '%Y-%c-%e') WHERE setting = 'Day'; +END; + + +-- Dumping structure for procedure altislife.resetGroupBuffs + +CREATE PROCEDURE IF NOT EXISTS `resetGroupBuffs`() +BEGIN + UPDATE `groups` SET buffs = '"[]"'; +END; + + +-- Dumping structure for procedure altislife.resetVehicles + +CREATE PROCEDURE IF NOT EXISTS `resetVehicles`() +BEGIN + UPDATE vehicles SET `active`='0'; + DELETE FROM vehicles WHERE sold='1'; +END; + + +-- Dumping structure for procedure altislife.resetWeeklyGoals + +CREATE PROCEDURE IF NOT EXISTS `resetWeeklyGoals`() +BEGIN + UPDATE players SET cop_weekly_tasks = '"[]"'; + UPDATE players SET med_weekly_tasks = '"[]"'; + UPDATE players SET hato_weekly_tasks = '"[]"'; + UPDATE players SET civ_weekly_tasks = '"[]"'; + UPDATE settings SET `value`=WEEK(CURDATE()) WHERE setting = 'Week'; +END; + + +-- Dumping structure for procedure altislife.sortPremiumGroups + +CREATE PROCEDURE IF NOT EXISTS `sortPremiumGroups`() +BEGIN + UPDATE `groups` SET premium = '0' WHERE premium = '1' AND CURRENT_TIMESTAMP() > premium_expire; +END; + +-- Dumping structure for table altislife.players +CREATE TABLE IF NOT EXISTS `players` ( + `uid` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(17) NOT NULL, + `name` varchar(32) NOT NULL, + `aliases` text NOT NULL, + `cash` int(11) NOT NULL DEFAULT 0, + `bankacc` int(11) NOT NULL DEFAULT 0, + `group_id` int(11) NOT NULL DEFAULT -1, + `group_level` int(11) NOT NULL DEFAULT 0, + `coplevel` enum('0','1','2','3','4','5','6','7','8','9','10','11') NOT NULL DEFAULT '0', + `collevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `npaslevel` enum('0','1','2','3','4') NOT NULL DEFAULT '0', + `scolevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `ncalevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `mpulevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `rpulevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `sfolevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `uclevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `cop_licenses` text NOT NULL, + `cop_perks` text NOT NULL, + `cop_gear` text NOT NULL, + `cop_stats` varchar(25) NOT NULL DEFAULT '"[100,100,0]"', + `cop_daily_tasks` text NOT NULL, + `cop_weekly_tasks` text NOT NULL, + `cop_blacklisted` tinyint(4) NOT NULL DEFAULT 0, + `mediclevel` enum('0','1','2','3','4','5','6','7','8') NOT NULL DEFAULT '0', + `aalevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `hartlevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `hrlevel` enum('0','1','2','3') NOT NULL DEFAULT '0', + `med_licenses` text NOT NULL, + `med_perks` text NOT NULL, + `med_gear` text NOT NULL, + `med_stats` varchar(25) NOT NULL DEFAULT '"[100,100,0]"', + `med_daily_tasks` text NOT NULL, + `med_weekly_tasks` text NOT NULL, + `med_blacklisted` tinyint(4) NOT NULL DEFAULT 0, + `hatolevel` enum('0','1','2','3','4') NOT NULL DEFAULT '0', + `hato_licenses` text NOT NULL, + `hato_perks` text NOT NULL, + `hato_gear` text NOT NULL, + `hato_stats` varchar(25) NOT NULL DEFAULT '"[100,100,0]"', + `hato_daily_tasks` text NOT NULL, + `hato_weekly_tasks` text NOT NULL, + `hato_blacklisted` tinyint(4) NOT NULL DEFAULT 0, + `civ_licenses` text NOT NULL, + `civ_perks` text NOT NULL, + `civ_gear` text NOT NULL, + `civ_stats` varchar(25) NOT NULL DEFAULT '"[100,100,0]"', + `civ_daily_tasks` text NOT NULL, + `civ_weekly_tasks` text NOT NULL, + `arrested` tinyint(4) NOT NULL DEFAULT 0, + `prison_timer` int(11) NOT NULL DEFAULT 0, + `adminlevel` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0', + `eventslevel` enum('0','1','2') NOT NULL DEFAULT '0', + `donorlevel` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0', + `prestige` int(11) NOT NULL DEFAULT 0, + `level` int(11) NOT NULL DEFAULT 1, + `xp` int(11) NOT NULL DEFAULT 0, + `reputation` int(11) NOT NULL DEFAULT 0, + `professions` text NOT NULL, + `achievements` text NOT NULL, + `titles` text NOT NULL, + `textures` text NOT NULL, + `blueprints` text NOT NULL, + `playtime` varchar(32) NOT NULL DEFAULT '"[0,0,0,0]"', + `insert_time` timestamp NOT NULL DEFAULT current_timestamp(), + `last_seen` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`pid`), + UNIQUE KEY `unique_uid` (`uid`), + KEY `index_name` (`name`), + KEY `index_blacklist` (`cop_blacklisted`,`med_blacklisted`) USING BTREE, + KEY `hato_blacklisted` (`hato_blacklisted`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Dumping structure for table altislife.groups +CREATE TABLE IF NOT EXISTS `groups` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `owner` varchar(17) NOT NULL, + `type` varchar(32) DEFAULT NULL, + `tag` varchar(5) DEFAULT NULL, + `name` varchar(32) DEFAULT NULL, + `level` int(11) DEFAULT 0, + `xp` int(11) DEFAULT 0, + `bank` int(11) DEFAULT 0, + `tax` float DEFAULT 0, + `active` tinyint(4) NOT NULL DEFAULT 1, + `premium` tinyint(4) NOT NULL DEFAULT 0, + `ranks` text NOT NULL, + `buffs` text NOT NULL, + `deposit` tinyint(4) NOT NULL DEFAULT 6, + `withdraw` tinyint(4) NOT NULL DEFAULT 6, + `rank` tinyint(4) NOT NULL DEFAULT 6, + `invite` tinyint(4) NOT NULL DEFAULT 6, + `kick` tinyint(4) NOT NULL DEFAULT 6, + `premium_expire` date NOT NULL DEFAULT (CURRENT_TIMESTAMP), + `insert_time` timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP), + PRIMARY KEY (`id`), + UNIQUE KEY `unique_name` (`name`), + UNIQUE KEY `unique_tag` (`tag`) USING BTREE, + KEY `fkIdx_players_gangs` (`owner`), + CONSTRAINT `FK_players_gangs` FOREIGN KEY (`owner`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Dumping structure for table altislife.base_bids +CREATE TABLE IF NOT EXISTS `base_bids` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `base` varchar(50) NOT NULL, + `group_id` int(11) NOT NULL, + `bid` int(11) NOT NULL DEFAULT 0, + `active` tinyint(4) NOT NULL DEFAULT 1, + PRIMARY KEY (`id`), + KEY `FK_base_bids_groups` (`group_id`), + CONSTRAINT `FK_base_bids_groups` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.candidates +CREATE TABLE IF NOT EXISTS `candidates` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `pid` varchar(50) NOT NULL, + `active` tinyint(4) NOT NULL DEFAULT 1, + PRIMARY KEY (`id`), + KEY `FK_candidates_players` (`pid`), + CONSTRAINT `FK_candidates_players` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.community_goals +CREATE TABLE IF NOT EXISTS `community_goals` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `goal_cfg` varchar(50) NOT NULL, + `end_date` date NOT NULL, + `paid` tinyint(4) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.community_goal_contributions +CREATE TABLE IF NOT EXISTS `community_goal_contributions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(17) NOT NULL, + `goalId` int(11) NOT NULL DEFAULT 0, + `contribution` int(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `pid` (`pid`,`goalId`), + KEY `FK_community_goal_contributions_community_goals` (`goalId`), + CONSTRAINT `FK_community_goal_contributions_community_goals` FOREIGN KEY (`goalId`) REFERENCES `community_goals` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION, + CONSTRAINT `FK_community_goal_contributions_players` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.houses +CREATE TABLE IF NOT EXISTS `houses` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(17) NOT NULL, + `classname` varchar(64) DEFAULT NULL, + `pos` varchar(32) DEFAULT NULL, + `name` varchar(32) DEFAULT '', + `storage` text DEFAULT NULL, + `virtualStorage` text DEFAULT NULL, + `shared` tinyint(4) DEFAULT 0, + `sold` tinyint(4) DEFAULT 0, + `insert_time` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `pos` (`pos`), + KEY `fkIdx_players_houses` (`pid`), + CONSTRAINT `FK_players_houses` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.logs +CREATE TABLE IF NOT EXISTS `logs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `event` varchar(50) NOT NULL DEFAULT '', + `pid` varchar(17) NOT NULL DEFAULT '', + `content` text NOT NULL, + `insert` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `pid` (`pid`), + CONSTRAINT `FK_logs_players` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.logs_queue +CREATE TABLE IF NOT EXISTS `logs_queue` ( + `log_id` int(11) NOT NULL, + `handled` tinyint(4) NOT NULL DEFAULT 0, + `time` timestamp NOT NULL DEFAULT current_timestamp(), + KEY `FK_logs_queue_logs` (`log_id`), + CONSTRAINT `FK_logs_queue_logs` FOREIGN KEY (`log_id`) REFERENCES `logs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.mail +CREATE TABLE IF NOT EXISTS `mail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(50) NOT NULL, + `type` varchar(50) NOT NULL DEFAULT '', + `class` varchar(50) NOT NULL, + `data` text NOT NULL, + `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `claimed` tinyint(4) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `pid` (`pid`), + CONSTRAINT `FK__players` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.settings +CREATE TABLE IF NOT EXISTS `settings` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `setting` varchar(50) NOT NULL, + `value` varchar(300) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `setting` (`setting`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.vehicles +CREATE TABLE IF NOT EXISTS `vehicles` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(17) NOT NULL, + `faction` varchar(10) NOT NULL, + `classname` varchar(64) NOT NULL, + `type` varchar(16) NOT NULL, + `alive` tinyint(4) NOT NULL DEFAULT 1, + `active` tinyint(4) NOT NULL DEFAULT 0, + `sold` tinyint(4) NOT NULL DEFAULT 0, + `impound` int(11) NOT NULL DEFAULT 0, + `plate` varchar(50) NOT NULL DEFAULT '', + `texture` varchar(50) NOT NULL DEFAULT '', + `insert_time` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `fkIdx_players_vehicles` (`pid`), + KEY `index_type` (`type`), + KEY `index_side` (`faction`) USING BTREE, + CONSTRAINT `FK_players_vehicles` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.votes +CREATE TABLE IF NOT EXISTS `votes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(50) DEFAULT NULL, + `candidate` int(11) DEFAULT NULL, + `amount` int(11) DEFAULT 1, + `active` tinyint(4) DEFAULT 1, + PRIMARY KEY (`id`), + UNIQUE KEY `pid` (`pid`), + KEY `FK_votes_candidates` (`candidate`), + CONSTRAINT `FK_votes_candidates` FOREIGN KEY (`candidate`) REFERENCES `candidates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `FK_votes_players` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for table altislife.warrants +CREATE TABLE IF NOT EXISTS `warrants` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` varchar(50) NOT NULL, + `act` varchar(50) NOT NULL, + `crime` varchar(50) NOT NULL, + `info` text NOT NULL, + `insert` timestamp NOT NULL DEFAULT current_timestamp(), + `active` tinyint(4) NOT NULL DEFAULT 1, + PRIMARY KEY (`id`), + KEY `FK_warrants_players` (`pid`), + CONSTRAINT `FK_warrants_players` FOREIGN KEY (`pid`) REFERENCES `players` (`pid`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- Data exporting was unselected. + +-- Dumping structure for trigger altislife.logs_after_insert + +CREATE TRIGGER `logs_after_insert` AFTER INSERT ON `logs` FOR EACH ROW BEGIN + INSERT INTO logs_queue (log_id) VALUES (NEW.id); +END \ No newline at end of file diff --git a/Server Side/life_server/Functions/Bases/fn_initBases.sqf b/Server Side/life_server/Functions/Bases/fn_initBases.sqf index 520030452..cf08e84e1 100644 --- a/Server Side/life_server/Functions/Bases/fn_initBases.sqf +++ b/Server Side/life_server/Functions/Bases/fn_initBases.sqf @@ -15,12 +15,12 @@ private _hours = getArray (missionConfigFile >> "CfgBases" >> "Restart"); if (([] call ULP_SRV_fnc_getDayName) isEqualTo getText (missionConfigFile >> "CfgBases" >> "Day") && { _hour >= (_hours select 0) } && { _hour < (_hours select 1) }) then { if !(ULP_SRV_Setting_BaseBidsActive) then { - ["UPDATE settings SET value = '1' WHERE setting = 'BaseBidsActive'", 1] call DB_fnc_asyncCall; + ["UPDATE settings SET `value` = '1' WHERE setting = 'BaseBidsActive'", 1] call DB_fnc_asyncCall; missionNamespace setVariable ["ULP_SRV_Setting_BaseBidsActive", true, true]; }; } else { if (ULP_SRV_Setting_BaseBidsActive) then { - ["UPDATE settings SET value = '0' WHERE setting = 'BaseBidsActive'", 1] call DB_fnc_asyncCall; + ["UPDATE settings SET `value` = '0' WHERE setting = 'BaseBidsActive'", 1] call DB_fnc_asyncCall; missionNamespace setVariable ["ULP_SRV_Setting_BaseBidsActive", false, true]; _newOwners = true; @@ -32,14 +32,14 @@ if (([] call ULP_SRV_fnc_getDayName) isEqualTo getText (missionConfigFile >> "Cf private _owner = -1; - private _query = [format ["SELECT value FROM settings WHERE setting = 'base_owner_%1'", configName _x], 2] call DB_fnc_asyncCall; + private _query = [format ["SELECT `value` FROM settings WHERE setting = 'base_owner_%1'", configName _x], 2] call DB_fnc_asyncCall; _query params [ ["_queryOwner", -2, [0, ""]] ]; if (_queryOwner isEqualTo -2) then { // Insert... - [format ["INSERT INTO settings (setting, value) VALUES ('base_owner_%1', '%2');", configName _x, getNumber(_x >> "defaultGroupOwnerId")], 1] call DB_fnc_asyncCall; + [format ["INSERT INTO settings (setting, `value`) VALUES ('base_owner_%1', '%2');", configName _x, getNumber(_x >> "defaultGroupOwnerId")], 1] call DB_fnc_asyncCall; } else { // This base is part of bidding wars @@ -48,11 +48,11 @@ if (([] call ULP_SRV_fnc_getDayName) isEqualTo getText (missionConfigFile >> "Cf // This base is part of bidding and bidding is active so we need to wipe current owner if (missionNamespace getVariable ["ULP_SRV_Setting_BaseBidsActive", false]) exitWith { _queryOwner = -1; - [format ["UPDATE settings SET value = '-1' WHERE setting = 'base_owner_%1'", configName _x], 1] call DB_fnc_asyncCall; + [format ["UPDATE settings SET `value` = '-1' WHERE setting = 'base_owner_%1'", configName _x], 1] call DB_fnc_asyncCall; }; if (_newOwners) then { - private _query = [format ["SELECT groups.id, groups.bank, base_bids.bid FROM base_bids INNER JOIN groups WHERE base_bids.base = '%1' AND base_bids.group_id = groups.id AND base_bids.bid <= groups.bank AND base_bids.active = '1' ORDER BY base_bids.bid DESC", configName _x], 2] call DB_fnc_asyncCall; + private _query = [format ["SELECT `groups`.id, `groups`.bank, base_bids.bid FROM base_bids INNER JOIN `groups` WHERE base_bids.base = '%1' AND base_bids.group_id = `groups`.id AND base_bids.bid <= `groups`.bank AND base_bids.active = '1' ORDER BY base_bids.bid DESC", configName _x], 2] call DB_fnc_asyncCall; _query params [ ["_id", -1, [0]], ["_bank", 0, [0]], @@ -69,9 +69,9 @@ if (([] call ULP_SRV_fnc_getDayName) isEqualTo getText (missionConfigFile >> "Cf ["SYSTEM", "BaseBid", ["Winner", [_id, [_newFunds, ""] call ULP_fnc_numberText, [_bid, ""] call ULP_fnc_numberText]]] call ULP_SRV_fnc_logPlayerEvent; // Update group bank, settings, and make bids inactive - [format ["UPDATE groups SET bank = '%2' WHERE id = '%1'", _id, [_newFunds, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; - [format ["UPDATE settings SET value = '%2' WHERE setting = 'base_owner_%1'", configName _x, _id], 1] call DB_fnc_asyncCall; - [format ["UPDATE base_bids SET active = '0' WHERE base = '%1'", configName _x], 1] call DB_fnc_asyncCall; + [format ["UPDATE `groups` SET bank = '%2' WHERE id = '%1'", _id, [_newFunds, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; + [format ["UPDATE settings SET `value` = '%2' WHERE setting = 'base_owner_%1'", configName _x, _id], 1] call DB_fnc_asyncCall; + [format ["UPDATE base_bids SET `active` = '0' WHERE base = '%1'", configName _x], 1] call DB_fnc_asyncCall; _queryOwner = _id; }; diff --git a/Server Side/life_server/Functions/Database/Government/fn_enlistCandidate.sqf b/Server Side/life_server/Functions/Database/Government/fn_enlistCandidate.sqf index 1717997e6..80b9b0217 100644 --- a/Server Side/life_server/Functions/Database/Government/fn_enlistCandidate.sqf +++ b/Server Side/life_server/Functions/Database/Government/fn_enlistCandidate.sqf @@ -17,7 +17,7 @@ if !([group _candidate] call ULP_fnc_isGroup || { ["Governor", group _candidate] private _steamid = getPlayerUID _candidate; -if !(([format["SELECT * FROM candidates WHERE pid = '%1'", _steamid], 2] call DB_fnc_asyncCall) isEqualTo []) exitWith { +if !(([format["SELECT * FROM `candidates` WHERE `pid` = '%1'", _steamid], 2] call DB_fnc_asyncCall) isEqualTo []) exitWith { ["Enlistment", ["You're already enlisted for the next general election..."]] remoteExecCall ["ULP_fnc_invokeEvent", _candidate]; }; @@ -25,5 +25,5 @@ if (((missionNamespace getVariable ["ULP_SRV_Setting_Governor", []]) param [1, " ["Enlistment", ["As Governor, you're unable to run in the next election..."]] remoteExecCall ["ULP_fnc_invokeEvent", _candidate]; }; -[format["INSERT INTO candidates (pid, name) VALUES ('%1', '%2');", _steamid, [name _candidate] call DB_fnc_mresString], 1] call DB_fnc_asyncCall; +[format["INSERT INTO `candidates` (`pid`, `name`) VALUES ('%1', '%2');", _steamid, [name _candidate] call DB_fnc_mresString], 1] call DB_fnc_asyncCall; ["Enlistment"] remoteExecCall ["ULP_fnc_invokeEvent", _candidate]; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Government/fn_getCandidates.sqf b/Server Side/life_server/Functions/Database/Government/fn_getCandidates.sqf index 80e4c798d..1e7e5d9c5 100644 --- a/Server Side/life_server/Functions/Database/Government/fn_getCandidates.sqf +++ b/Server Side/life_server/Functions/Database/Government/fn_getCandidates.sqf @@ -11,7 +11,7 @@ _this params [ private _candidates = []; -private _query = ["SELECT candidates.id, players.pid, candidates.name, groups.name, groups.type, groups.level FROM candidates INNER JOIN players ON players.pid = candidates.pid INNER JOIN groups ON groups.id = players.group_id WHERE candidates.active = '1' AND groups.active = '1'", 2, true] call DB_fnc_asyncCall; +private _query = ["SELECT `candidates`.`id`, `players`.`pid`, `candidates`.`name`, `groups`.`name`, `groups`.`type`, `groups`.`level` FROM `candidates` INNER JOIN `players` ON `players`.`pid` = `candidates`.`pid` INNER JOIN `groups` ON `groups`.`id` = `players`.`group_id` WHERE `candidates`.`active` = '1' AND `groups`.`active` = '1'", 2, true] call DB_fnc_asyncCall; if !(_query isEqualTo "" || { _query isEqualTo [] }) then { // Filter where groups don't have correct perk diff --git a/Server Side/life_server/Functions/Database/Government/fn_handleVotes.sqf b/Server Side/life_server/Functions/Database/Government/fn_handleVotes.sqf index a75a8ffe3..51394fbe1 100644 --- a/Server Side/life_server/Functions/Database/Government/fn_handleVotes.sqf +++ b/Server Side/life_server/Functions/Database/Government/fn_handleVotes.sqf @@ -5,7 +5,7 @@ #include "\life_server\script_macros.hpp" scopeName "fn_handleVotes"; -private _winner = ["SELECT candidates.`name`, candidates.pid, (SELECT SUM(vote_count.amount) FROM votes AS vote_count WHERE vote_count.candidate = candidates.id) AS total_votes FROM candidates INNER JOIN votes ON candidates.id = votes.candidate WHERE candidates.active = '1' AND votes.active = '1' ORDER BY total_votes DESC LIMIT 1;", 2] call DB_fnc_asyncCall; +private _winner = ["SELECT `candidates`.`name`, `candidates`.`pid`, (SELECT SUM(`vote_count`.`amount`) FROM `votes` AS `vote_count` WHERE `vote_count`.`candidate` = `candidates`.`id`) AS `total_votes` FROM `candidates` INNER JOIN `votes` ON `candidates`.`id` = `votes`.`candidate` WHERE `candidates`.`active` = '1' AND `votes`.`active` = '1' ORDER BY `total_votes` DESC LIMIT 1;", 2] call DB_fnc_asyncCall; if !(_winner isEqualType []) then { _winner = []; }; if !(_winner isEqualTo []) then { @@ -15,11 +15,11 @@ if !(_winner isEqualTo []) then { [format ["Election Winner: %1 (%2) with %3 votes", _name, _steamid, [_votes] call ULP_fnc_numberText]] call ULP_fnc_logIt; ["SYSTEM", "Election", ["Winner", [_name, _steamid, [_votes, ""] call ULP_fnc_numberText]]] call ULP_SRV_fnc_logPlayerEvent; - [format ["UPDATE settings SET value = '%1' WHERE setting = 'Governor'", [[_name, _steamid]] call DB_fnc_mresArray], 1] call DB_fnc_asyncCall; + [format ["UPDATE `settings` SET `value` = '%1' WHERE `setting` = 'Governor'", [[_name, _steamid]] call DB_fnc_mresArray], 1] call DB_fnc_asyncCall; missionNamespace setVariable ["ULP_SRV_Setting_Governor", [_name, _steamid], true]; }; // Wipe... -["UPDATE candidates SET active = '0'", 1] call DB_fnc_asyncCall; -["UPDATE votes SET active = '0'", 1] call DB_fnc_asyncCall; \ No newline at end of file +["UPDATE `candidates` SET `active` = '0'", 1] call DB_fnc_asyncCall; +["UPDATE `votes` SET `active` = '0'", 1] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Government/fn_saveLegislation.sqf b/Server Side/life_server/Functions/Database/Government/fn_saveLegislation.sqf index 81f81873b..bb683e9b9 100644 --- a/Server Side/life_server/Functions/Database/Government/fn_saveLegislation.sqf +++ b/Server Side/life_server/Functions/Database/Government/fn_saveLegislation.sqf @@ -15,7 +15,7 @@ _settings set [_legislation, _value]; missionNamespace setVariable ["ULP_SRV_Setting_GovernorSettings", _settings, true]; [format[ - "UPDATE settings SET value='%1' WHERE setting='GovernorSettings'", + "UPDATE `settings` SET `value`='%1' WHERE `setting`='GovernorSettings'", [_settings] call DB_fnc_mresArray ], 1] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Government/fn_submitVote.sqf b/Server Side/life_server/Functions/Database/Government/fn_submitVote.sqf index 4c20515a2..4387b4bff 100644 --- a/Server Side/life_server/Functions/Database/Government/fn_submitVote.sqf +++ b/Server Side/life_server/Functions/Database/Government/fn_submitVote.sqf @@ -36,5 +36,5 @@ if !(isNull _riggedGroup && { ([_riggedGroup] call ULP_fnc_groupId) isEqualTo -1 }; }; -[format["INSERT INTO votes (pid, candidate, amount) VALUES ('%1', '%2', '%3');", _steamid, _candidate select 0, _amount], 1] call DB_fnc_asyncCall; +[format["INSERT INTO `votes` (`pid`, `candidate`, `amount`) VALUES ('%1', '%2', '%3');", _steamid, _candidate select 0, _amount], 1] call DB_fnc_asyncCall; ["ElectionVoteSubmitted"] remoteExecCall ["ULP_fnc_invokeEvent", _voter]; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Group/fn_addGroupBuff.sqf b/Server Side/life_server/Functions/Database/Group/fn_addGroupBuff.sqf index 2bf869b27..17a68abd7 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_addGroupBuff.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_addGroupBuff.sqf @@ -23,7 +23,7 @@ if !(_level isEqualTo _current) then { _group setVariable ["group_buffs", _buffs, true]; [format[ - "UPDATE groups SET buffs='%2' WHERE id='%1'", + "UPDATE `groups` SET `buffs`='%2' WHERE `id`='%1'", [[_group] call ULP_fnc_groupId, ""] call ULP_fnc_numberText, [_buffs] call DB_fnc_mresArray ], 1] call DB_fnc_asyncCall; }; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Group/fn_addGroupXP.sqf b/Server Side/life_server/Functions/Database/Group/fn_addGroupXP.sqf index d409df78c..24fcc410c 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_addGroupXP.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_addGroupXP.sqf @@ -41,7 +41,7 @@ for "_i" from 0 to 1 step 0 do { _group setVariable ["group_progression", [_level, _xp], true]; [format[ - "UPDATE groups SET level='%2', xp='%3' WHERE id='%1'", + "UPDATE `groups` SET `level`='%2', `xp`='%3' WHERE `id`='%1'", [[_group] call ULP_fnc_groupId, ""] call ULP_fnc_numberText, [_level, ""] call ULP_fnc_numberText, [_xp, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Group/fn_createGroup.sqf b/Server Side/life_server/Functions/Database/Group/fn_createGroup.sqf index a26c035fc..8bd46d1fa 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_createGroup.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_createGroup.sqf @@ -28,7 +28,7 @@ private _kickIndex = getNumber (missionConfigFile >> "CfgGroups" >> "Permissions private _level = ((count _ranks) - 1); private _members = createHashMapFromArray [[_steamid, [name _owner, _level]]]; -private _query = [format["SELECT id, tag, name, active FROM groups WHERE tag = '%1' OR name = '%2'", +private _query = [format["SELECT `id`, `tag`, `name`, `active` FROM `groups` WHERE `tag` = '%1' OR `name` = '%2'", _tag, _name ], 2] call DB_fnc_asyncCall; @@ -52,7 +52,7 @@ if !(_query isEqualTo "" || { _query isEqualTo [] }) then { }; // This gang has something matching but is also inactive, to save queries we can just update this one as ours... - [format["UPDATE groups SET owner = '%1', type = '%9', tag = '%2', name = '%3', ranks = '%5', deposit = '%6', withdraw = '%7', rank = '%8', invite = '%9', kick = '%10', level = '0', xp = '0', bank = '0', premium = '0', active = '1', buffs = '""[]""' WHERE id = '%4'", + [format["UPDATE `groups` SET `owner` = '%1', `type` = '%9', `tag` = '%2', `name` = '%3', `ranks` = '%5', `deposit` = '%6', `withdraw` = '%7', `rank` = '%8', `invite` = '%9', `kick` = '%10', `level` = '0', `xp` = '0', `bank` = '0', `premium` = '0', `active` = '1', `buffs` = '""[]""' WHERE `id` = '%4'", _steamid, _tag, _name, _queryId, [_ranks] call DB_fnc_mresArray, _depositIndex, _withdrawIndex, _rankIndex, _type, _inviteIndex, _kickIndex ], 1] call DB_fnc_asyncCall; @@ -109,8 +109,8 @@ if !(_query isEqualTo "" || { _query isEqualTo [] }) then { // Insert... [format[ - "INSERT INTO groups (owner, type, tag, name, ranks, deposit, withdraw, rank, invite, kick, buffs) VALUES ('%1', '%8', '%2', '%3', '%4', '%5', '%6', '%7', '%9', '%10', '""[]""');", - _steamid, _tag, _name, [_ranks] call DB_fnc_mresArray, _depositIndex, _withdrawIndex, _rankIndex, _type, _inviteIndex, _kickIndex + "INSERT INTO `groups` (`id`, `owner`, `type`, `tag`, `name`, `ranks`, `deposit`, `withdraw`, `rank`, `invite`, `kick`, `buffs`) VALUES ('%1', '%2', '%9', '%3', '%4', '%5', '%6', '%7', '%8', '%10', '%11', '""[]""');", + [_id, ""] call ULP_fnc_numberText, _steamid, _tag, _name, [_ranks] call DB_fnc_mresArray, _depositIndex, _withdrawIndex, _rankIndex, _type, _inviteIndex, _kickIndex ], 1] call DB_fnc_asyncCall; private _group = createGroup [(side _owner), false]; @@ -127,7 +127,7 @@ if !(_query isEqualTo "" || { _query isEqualTo [] }) then { _owner setUnitRank (_ranks select _level); // Update Owner's Gang ID... -[format["UPDATE players SET group_id = '%1', group_level = '%3' WHERE pid = '%2'", +[format["UPDATE `players` SET `group_id` = '%1', `group_level` = '%3' WHERE `pid` = '%2'", _id, _steamid, _level ], 1] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Group/fn_disbandGroup.sqf b/Server Side/life_server/Functions/Database/Group/fn_disbandGroup.sqf index 3a5f29d42..ec1c61ad3 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_disbandGroup.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_disbandGroup.sqf @@ -14,9 +14,9 @@ private _groupid = [_group] call ULP_fnc_groupId; if (_groupid isEqualTo -1) exitWith {}; -[format["UPDATE candidates INNER JOIN players ON candidates.pid = players.pid SET candidates.active='0' WHERE players.group_id='%1';", [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; -[format["UPDATE groups SET active='0' WHERE id='%1'", [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; -[format["UPDATE players SET group_id = '-1', group_level = '0' WHERE group_id='%1'", [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `candidates` INNER JOIN `players` ON `candidates`.`pid` = `players`.`pid` SET `candidates`.`active`='0' WHERE `players`.`group_id`='%1';", [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `groups` SET `active`='0' WHERE `id`='%1'", [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `players` SET `group_id` = '-1', `group_level` = '0' WHERE `group_id`='%1'", [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; if !(isNull _unit) then { [getPlayerUID _unit, "Group", ["Disband", _groupid, [(_group getVariable ["group_funds", 0]), ""] call ULP_fnc_numberText]] call ULP_SRV_fnc_logPlayerEvent; diff --git a/Server Side/life_server/Functions/Database/Group/fn_handleGroupFunds.sqf b/Server Side/life_server/Functions/Database/Group/fn_handleGroupFunds.sqf index ae2fb2e8c..ed928cecd 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_handleGroupFunds.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_handleGroupFunds.sqf @@ -42,7 +42,7 @@ if (_add) then { if !((_group getVariable ["group_funds", 0]) isEqualTo _funds) then { if (_groupId > 0) then { [format[ - "UPDATE groups SET bank='%2' WHERE id='%1'", + "UPDATE `groups` SET bank='%2' WHERE id='%1'", [_groupId, ""] call ULP_fnc_numberText, [_funds, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Group/fn_queryGroupInfo.sqf b/Server Side/life_server/Functions/Database/Group/fn_queryGroupInfo.sqf index c3ee40be1..c2fdc0045 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_queryGroupInfo.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_queryGroupInfo.sqf @@ -20,7 +20,7 @@ private _group = [_groupid] call ULP_fnc_getGroupById; private _ranks = getArray (missionConfigFile >> "CfgGroups" >> "ranks"); if (isNull _group) then { - private _query = [format["SELECT groups.id, groups.tag, groups.owner, groups.type, players.group_level, groups.name, groups.ranks, groups.bank, groups.tax, groups.premium, groups.deposit, groups.withdraw, groups.rank, groups.invite, groups.kick, groups.level, groups.xp, groups.buffs FROM groups INNER JOIN players ON players.group_id = groups.id AND players.pid = '%1' WHERE (groups.owner = '%1' OR groups.id = '%2') AND groups.active='1'", + private _query = [format["SELECT `groups`.`id`, `groups`.`tag`, `groups`.`owner`, `groups`.`type`, `players`.`group_level`, `groups`.`name`, `groups`.`ranks`, `groups`.`bank`, `groups`.`tax`, `groups`.`premium`, `groups`.`deposit`, `groups`.`withdraw`, `groups`.`rank`, `groups`.`invite`, `groups`.`kick`, `groups`.`level`, `groups`.`xp`, `groups`.`buffs` FROM `groups` INNER JOIN `players` ON `players`.`group_id` = `groups`.`id` AND `players`.`pid` = '%1' WHERE (`groups`.`owner` = '%1' OR `groups`.`id` = '%2') AND `groups`.`active`='1'", _steamid, _groupid ], 2] call DB_fnc_asyncCall; @@ -66,7 +66,7 @@ if (isNull _group) then { _group setVariable ["group_premium", _queryPremium, true]; }; - private _members = [format ["SELECT name, pid, group_level FROM players WHERE group_id = '%1'", _groupid], 2, true] call DB_fnc_asyncCall; + private _members = [format ["SELECT `name`, `pid`, `group_level` FROM `players` WHERE `group_id` = '%1'", _groupid], 2, true] call DB_fnc_asyncCall; if !(_members isEqualTo []) then { private _hash = createHashMap; diff --git a/Server Side/life_server/Functions/Database/Group/fn_setGroupId.sqf b/Server Side/life_server/Functions/Database/Group/fn_setGroupId.sqf index 654fa22fe..0655abdae 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_setGroupId.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_setGroupId.sqf @@ -14,11 +14,11 @@ if (_steamid isEqualTo "") exitWith { false }; // If we're setting our id to less than 0 we're probably leaving... if (_groupid < 0) then { - [format["UPDATE candidates SET active='0' WHERE pid='%1';", _steamid], 1] call DB_fnc_asyncCall; + [format["UPDATE `candidates` SET `active`='0' WHERE `pid`='%1';", _steamid], 1] call DB_fnc_asyncCall; }; [format[ - "UPDATE players SET group_id = '%2', group_level = '0' WHERE pid='%1'", + "UPDATE `players` SET `group_id` = '%2', `group_level` = '0' WHERE `pid`='%1'", _steamid, [_groupid, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; true \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Group/fn_setGroupOwner.sqf b/Server Side/life_server/Functions/Database/Group/fn_setGroupOwner.sqf index dd13196d5..1cc35fb84 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_setGroupOwner.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_setGroupOwner.sqf @@ -14,10 +14,10 @@ _this params [ if (_groupid < 0 || { _owner isEqualTo "" } || { _new isEqualTo "" }) exitWith { false }; // Update Group Information... -[format["UPDATE groups SET owner = '%1' WHERE owner='%2' AND id = '%3'", _new, _owner, [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `groups` SET `owner` = '%1' WHERE `owner`='%2' AND `id` = '%3'", _new, _owner, [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; // Update Player Information... -[format["UPDATE players SET group_level = '5' WHERE pid='%1' AND group_id = '%2'", _owner, [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; -[format["UPDATE players SET group_level = '6' WHERE pid='%1' AND group_id = '%2'", _new, [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `players` SET `group_level` = '5' WHERE `pid`='%1' AND `group_id` = '%2'", _owner, [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `players` SET `group_level` = '6' WHERE `pid`='%1' AND `group_id` = '%2'", _new, [_groupid, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; true \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Group/fn_setGroupTax.sqf b/Server Side/life_server/Functions/Database/Group/fn_setGroupTax.sqf index 85a32d070..dd9295389 100644 --- a/Server Side/life_server/Functions/Database/Group/fn_setGroupTax.sqf +++ b/Server Side/life_server/Functions/Database/Group/fn_setGroupTax.sqf @@ -17,7 +17,7 @@ _tax = _tax / 100; _group setVariable ["group_tax", _tax, true]; // Update Group Information... -[format["UPDATE groups SET tax = '%1' WHERE id = '%2'", +[format["UPDATE `groups` SET `tax` = '%1' WHERE `id` = '%2'", [_tax, ""] call ULP_fnc_numberText, [[_group] call ULP_fnc_groupId, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Housing/fn_buyHouse.sqf b/Server Side/life_server/Functions/Database/Housing/fn_buyHouse.sqf index 07da0d8f3..d46335fa3 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_buyHouse.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_buyHouse.sqf @@ -22,7 +22,7 @@ if (isNull _house || { !([_house] call ULP_fnc_isHouse) } || { [_house] call ULP private _steamid = getPlayerUID _buyer; // Check House Limit... -private _query = [format["SELECT count(id) FROM houses WHERE pid='%1' AND sold='0'", _steamid], 2] call DB_fnc_asyncCall; +private _query = [format["SELECT count(`id`) FROM `houses` WHERE `pid`='%1' AND `sold`='0'", _steamid], 2] call DB_fnc_asyncCall; _query params [ ["_count", 0, [0]] @@ -38,8 +38,8 @@ private _id = ["houses"] call ULP_SRV_fnc_getNextId; // Insert... [format[ - "INSERT INTO houses (pid, classname, pos, storage, virtualStorage) VALUES ('%1', '%2', '%3', '""[]""', '""[]""');", - _steamid, (typeOf _house), [getPos _house] call DB_fnc_mresArray + "INSERT INTO `houses` (`id`, `pid`, `classname`, `pos`, `storage`, `virtualStorage`) VALUES ('%1', '%2', '%3', '%4', '""[]""', '""[]""');", + [_id, ""] call ULP_fnc_numberText, _steamid, (typeOf _house), [getPos _house] call DB_fnc_mresArray ], 1] call DB_fnc_asyncCall; [_house, [_id, [_steamid, ([group _buyer] call ULP_fnc_groupId), name _buyer]]] call ULP_SRV_fnc_setupHouse; diff --git a/Server Side/life_server/Functions/Database/Housing/fn_initHousing.sqf b/Server Side/life_server/Functions/Database/Housing/fn_initHousing.sqf index 94bfda7a9..baa4caee1 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_initHousing.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_initHousing.sqf @@ -11,7 +11,7 @@ if (canSuspend) exitWith { ["Setting Up Housing..."] call ULP_fnc_logIt; -private _query = ["SELECT houses.id, houses.pid, players.group_id, players.name, houses.classname, houses.pos, houses.name, houses.storage, houses.virtualStorage, houses.shared FROM houses INNER JOIN players ON players.pid = houses.pid WHERE houses.sold='0'", 2, true] call DB_fnc_asyncCall; +private _query = ["SELECT `houses`.`id`, `houses`.`pid`, `players`.`group_id`, `players`.`name`, `houses`.`classname`, `houses`.`pos`, `houses`.`name`, `houses`.`storage`, `houses`.`virtualStorage`, `houses`.`shared` FROM `houses` INNER JOIN `players` ON `players`.`pid` = `houses`.`pid` WHERE `houses`.`sold`='0'", 2, true] call DB_fnc_asyncCall; if (_query isEqualTo "" || { _query isEqualTo [] }) exitWith { 0 }; @@ -33,7 +33,7 @@ ULP_SRV_Houses = []; [format ["House wasn't found: %1 at %2 (%3, %4)", _classname, _pos, _id, (_house in ULP_SRV_Houses)]] call ULP_fnc_logIt; } else { if (_house getVariable ["blacklisted", false]) then { - [format["UPDATE houses SET sold='1' WHERE id='%1'", [_id, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; + [format["UPDATE `houses` SET `sold`='1' WHERE `id`='%1'", [_id, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; [_steamid, "House", ["Blacklisted", getPos _house, [0, ""] call ULP_fnc_numberText]] call ULP_SRV_fnc_logPlayerEvent; } else { [_house, [_id, [_pid, _gangId, _ownerName], _shared, _name, _storage, _virtualStorage]] call ULP_SRV_fnc_setupHouse; diff --git a/Server Side/life_server/Functions/Database/Housing/fn_saveStorage.sqf b/Server Side/life_server/Functions/Database/Housing/fn_saveStorage.sqf index 78857091d..ccda814ea 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_saveStorage.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_saveStorage.sqf @@ -33,7 +33,7 @@ _box setVariable ["ULP_PhysicalCargo", _storage]; [ format [ - "UPDATE houses SET storage='%1' WHERE id='%2'", + "UPDATE `houses` SET `storage`='%1' WHERE `id`='%2'", [_storage] call DB_fnc_mresArray, [_id, ""] call ULP_fnc_numberText ], 1 ] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Housing/fn_saveVirtualStorage.sqf b/Server Side/life_server/Functions/Database/Housing/fn_saveVirtualStorage.sqf index 4040657f6..f01fd2f82 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_saveVirtualStorage.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_saveVirtualStorage.sqf @@ -23,7 +23,7 @@ if (_curStorage isEqualTo _lastStorage) exitWith { false }; [ format [ - "UPDATE houses SET virtualStorage='%1' WHERE id='%2'", + "UPDATE `houses` SET `virtualStorage`='%1' WHERE `id`='%2'", [_curStorage] call DB_fnc_mresArray, [_id, ""] call ULP_fnc_numberText ], 1 ] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Housing/fn_sellHouse.sqf b/Server Side/life_server/Functions/Database/Housing/fn_sellHouse.sqf index 5c516ed0a..ee0f2c53b 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_sellHouse.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_sellHouse.sqf @@ -24,7 +24,7 @@ if (isNull _house || { !([_house] call ULP_fnc_isHouse) } || { !(_steamid isEqua ["HouseSold", [_house, false, "You don't have permission to sell this house..."]] remoteExecCall ["ULP_fnc_invokeEvent", remoteExecutedOwner]; }; -[format["UPDATE houses SET sold='1' WHERE id='%1'", [(_house getVariable ["building_id", -1]), ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `houses` SET `sold`='1' WHERE `id`='%1'", [(_house getVariable ["building_id", -1]), ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; private _cfg = missionConfigFile >> "CfgHousing" >> "houses" >> (typeOf _house); diff --git a/Server Side/life_server/Functions/Database/Housing/fn_setHouseName.sqf b/Server Side/life_server/Functions/Database/Housing/fn_setHouseName.sqf index 26844a6f1..d6aa3f5d0 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_setHouseName.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_setHouseName.sqf @@ -15,6 +15,6 @@ if (_id < 0) exitWith {}; _id = [_id, ""] call ULP_fnc_numberText; [format[ - "UPDATE houses SET name='%2' WHERE id='%1'", + "UPDATE `houses` SET `name`='%2' WHERE `id`='%1'", _id, [_name] call DB_fnc_mresString ], 1] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Housing/fn_setHouseShared.sqf b/Server Side/life_server/Functions/Database/Housing/fn_setHouseShared.sqf index a2d8471f4..0d2629326 100644 --- a/Server Side/life_server/Functions/Database/Housing/fn_setHouseShared.sqf +++ b/Server Side/life_server/Functions/Database/Housing/fn_setHouseShared.sqf @@ -15,6 +15,6 @@ if (_id < 0) exitWith {}; _id = [_id, ""] call ULP_fnc_numberText; [format[ - "UPDATE houses SET shared='%2' WHERE id='%1'", + "UPDATE `houses` SET `shared`='%2' WHERE `id`='%1'", _id, [_shared] call ULP_fnc_bool ], 1] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Mail/fn_addMail.sqf b/Server Side/life_server/Functions/Database/Mail/fn_addMail.sqf index 66fce331f..3dd36e6ba 100644 --- a/Server Side/life_server/Functions/Database/Mail/fn_addMail.sqf +++ b/Server Side/life_server/Functions/Database/Mail/fn_addMail.sqf @@ -15,7 +15,7 @@ _this params [ if (_pid isEqualTo "" || { _type isEqualTo "" } || { _class isEqualTo "" }) exitWith { false }; [format[ - "INSERT INTO mail (pid, type, class, data) VALUES ('%1', '%2', '%3', '%4');", + "INSERT INTO `mail` (`pid`, `type`, `class`, `data`) VALUES ('%1', '%2', '%3', '%4');", _pid, _type, _class, (switch (true) do { case (_data isEqualType []) : { [_data] call DB_fnc_mresArray }; case (_data isEqualType 0) : { [_data, ""] call ULP_fnc_numberText }; diff --git a/Server Side/life_server/Functions/Database/Mail/fn_getMail.sqf b/Server Side/life_server/Functions/Database/Mail/fn_getMail.sqf index cc7861d6c..91369730e 100644 --- a/Server Side/life_server/Functions/Database/Mail/fn_getMail.sqf +++ b/Server Side/life_server/Functions/Database/Mail/fn_getMail.sqf @@ -11,7 +11,7 @@ _this params [ private _mail = []; -private _query = [format["SELECT id, pid, type, class, data FROM mail WHERE pid='%1' AND claimed='0'", _pid], 2, true] call DB_fnc_asyncCall; +private _query = [format["SELECT `id`, `pid`, `type`, `class`, `data` FROM `mail` WHERE `pid`='%1' AND `claimed`='0'", _pid], 2, true] call DB_fnc_asyncCall; if !(_pid isEqualTo "" || { _query isEqualTo "" } || { _query isEqualTo [] }) then { _mail = _query apply { diff --git a/Server Side/life_server/Functions/Database/Mail/fn_updateMail.sqf b/Server Side/life_server/Functions/Database/Mail/fn_updateMail.sqf index 958392dee..47d431336 100644 --- a/Server Side/life_server/Functions/Database/Mail/fn_updateMail.sqf +++ b/Server Side/life_server/Functions/Database/Mail/fn_updateMail.sqf @@ -15,7 +15,7 @@ _this params [ if (_mailId isEqualTo -1 || { _data isEqualTo -1 }) exitWith {}; [format[ - "UPDATE mail SET data='%2', claimed='%3' WHERE id='%1'", + "UPDATE `mail` SET `data`='%2', `claimed`='%3' WHERE `id`='%1'", [_mailId, ""] call ULP_fnc_numberText, (switch (true) do { case (_data isEqualType []) : { [_data] call DB_fnc_mresArray }; case (_data isEqualType 0) : { [_data, ""] call ULP_fnc_numberText }; diff --git a/Server Side/life_server/Functions/Database/Player/fn_logPlayerEvent.sqf b/Server Side/life_server/Functions/Database/Player/fn_logPlayerEvent.sqf index 0ac2813ee..a90142439 100644 --- a/Server Side/life_server/Functions/Database/Player/fn_logPlayerEvent.sqf +++ b/Server Side/life_server/Functions/Database/Player/fn_logPlayerEvent.sqf @@ -21,7 +21,7 @@ if (isNumber (_cfg >> "params") && { !((count _params) isEqualTo getNumber (_cfg }; [ - format ["INSERT INTO logs (event, pid, content) VALUES('%1', '%2', '%3')", + format ["INSERT INTO `logs` (`event`, `pid`, `content`) VALUES('%1', '%2', '%3')", _event, _steamid, [_params] call DB_fnc_mresArray diff --git a/Server Side/life_server/Functions/Database/Player/fn_queryPlayerInfo.sqf b/Server Side/life_server/Functions/Database/Player/fn_queryPlayerInfo.sqf index fedcd4952..0536259f5 100644 --- a/Server Side/life_server/Functions/Database/Player/fn_queryPlayerInfo.sqf +++ b/Server Side/life_server/Functions/Database/Player/fn_queryPlayerInfo.sqf @@ -20,7 +20,7 @@ private _playTimeIndex = getNumber(_factionCfg >> "DatabaseInfo" >> "timeIndex") private _query = [ format["SELECT uid, pid, group_id, cash, bankacc, playtime, insert_time, adminlevel, eventslevel, donorlevel, %1licenses, %1gear, %1stats, professions, prestige, level, xp, achievements, daily_tasks, weekly_tasks, textures, titles, %1perks, reputation, blueprints", getText(_factionCfg >> "DatabaseInfo" >> "queryPrefix")], getText(_factionCfg >> "DatabaseInfo" >> "customQuery"), - format["FROM players WHERE pid='%1'", _uid] + format["FROM `players` WHERE `pid`='%1'", _uid] ]; _query = _query joinString " "; diff --git a/Server Side/life_server/Functions/Database/Player/fn_savePlayerInfo.sqf b/Server Side/life_server/Functions/Database/Player/fn_savePlayerInfo.sqf index f0f08849b..7ca33bf09 100644 --- a/Server Side/life_server/Functions/Database/Player/fn_savePlayerInfo.sqf +++ b/Server Side/life_server/Functions/Database/Player/fn_savePlayerInfo.sqf @@ -39,7 +39,7 @@ _playtime = [_playtime] call DB_fnc_mresArray; [ format [ - "UPDATE players SET name='%2', cash='%3', bankacc='%4', %1gear='%5', %1licenses='%6', %1stats='%7', playtime='%8' WHERE pid='%9'", + "UPDATE `players` SET `name`='%2', `cash`='%3', `bankacc`='%4', `%1gear`='%5', `%1licenses`='%6', `%1stats`='%7', `playtime`='%8' WHERE `pid`='%9'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), _name, _cash, _bank, _gear, _licenses, _stats, _playtime, _steamid ], 1 ] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Player/fn_savePlayerState.sqf b/Server Side/life_server/Functions/Database/Player/fn_savePlayerState.sqf index ac9781985..c5bcf5d41 100644 --- a/Server Side/life_server/Functions/Database/Player/fn_savePlayerState.sqf +++ b/Server Side/life_server/Functions/Database/Player/fn_savePlayerState.sqf @@ -24,7 +24,7 @@ _faction = missionConfigFile >> "CfgFactions" >> _faction; if (_steamid isEqualTo "" || { _player isEqualType objNull && { !(isClass (_faction)) } }) exitWith {}; private _query = switch (_state) do { - case 0: { format["%1licenses='%2'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), [_data] call DB_fnc_mresArray] }; + case 0: { format["`%1licenses`='%2'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), [_data] call DB_fnc_mresArray] }; case 1: { _data params [["_total", 0, [0]], ["_amount", 0, [0]], ["_increase", true, [false]], ["_reason", "", [""]]]; if !([_player, [_player, "Cash"] call ULP_SRV_fnc_getSessionField, _total, _amount, _increase] call ULP_SRV_fnc_validateField) exitWith { "" }; @@ -33,7 +33,7 @@ private _query = switch (_state) do { _total = [_total, ""] call ULP_fnc_numberText; [_steamid, "Money", ["Cash", (["Removed", "Added"] select (_increase)), _total, [_amount, ""] call ULP_fnc_numberText, _reason]] call ULP_SRV_fnc_logPlayerEvent; - format["cash='%1'", _total] + format["`cash`='%1'", _total] }; case 2: { _data params [["_total", 0, [0]], ["_amount", 0, [0]], ["_increase", true, [false]], ["_reason", "", [""]]]; @@ -43,7 +43,7 @@ private _query = switch (_state) do { _total = [_total, ""] call ULP_fnc_numberText; [_steamid, "Money", ["Bank", (["Removed", "Added"] select (_increase)), _total, [_amount, ""] call ULP_fnc_numberText, _reason]] call ULP_SRV_fnc_logPlayerEvent; - format["bankacc='%1'", _total] + format["`bankacc`='%1'", _total] }; case 3: { format["professions='%1'", [_data] call DB_fnc_mresArray] }; case 4: { format["level = '%1', xp = '%2'", [(_data select 0), ""] call ULP_fnc_numberText, [(_data select 1), ""] call ULP_fnc_numberText]}; @@ -55,15 +55,15 @@ private _query = switch (_state) do { case 10: { format["titles='%1'", [_data] call DB_fnc_mresArray] }; case 11: { [_player, "Perks", _data] call ULP_SRV_fnc_setSessionField; - format["%1perks='%2'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), [_data] call DB_fnc_mresArray] + format["`%1perks`='%2'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), [_data] call DB_fnc_mresArray] }; - case 12: { format["group_id = '%1', group_level = '%2'", _data select 0, _data select 1] }; - case 13: { format["reputation = '%1'", [_data, ""] call ULP_fnc_numberText]}; - case 14: { format["blueprints='%1'", [_data] call DB_fnc_mresArray] }; - case 15: { format["%1gear='%2'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), [_data] call DB_fnc_mresArray] }; + case 12: { format["`group_id` = '%1', `group_level` = '%2'", _data select 0, _data select 1] }; + case 13: { format["`reputation` = '%1'", [_data, ""] call ULP_fnc_numberText]}; + case 14: { format["`blueprints` ='%1'", [_data] call DB_fnc_mresArray] }; + case 15: { format["`%1gear`='%2'", getText(_faction >> "DatabaseInfo" >> "queryPrefix"), [_data] call DB_fnc_mresArray] }; default { "" }; }; if (_query isEqualTo "") exitWith {}; -[format ["UPDATE players SET %1 WHERE pid='%2'", _query, _steamid], 1] call DB_fnc_asyncCall; \ No newline at end of file +[format ["UPDATE `players` SET %1 WHERE `pid`='%2'", _query, _steamid], 1] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_createVehicle.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_createVehicle.sqf index 885f6e46d..e63ce77d5 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_createVehicle.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_createVehicle.sqf @@ -31,8 +31,8 @@ private _id = ["vehicles"] call ULP_SRV_fnc_getNextId; // Insert... [format[ - "INSERT INTO vehicles (pid, faction, classname, type, texture, active) VALUES ('%1', '%2', '%3', '%4', '%5', '%6');", - _steamid, _faction, _class, _type, _texture, _active + "INSERT INTO `vehicles` (`id`, `pid`, `faction`, `classname`, `type`, `texture`, `active`) VALUES ('%1', '%2', '%3', '%4', '%5', '%6', '%7');", + [_id, ""] call ULP_fnc_numberText, _steamid, _faction, _class, _type, _texture, _active ], 1] call DB_fnc_asyncCall; ["VehicleBought", [[_class, _spawn, _texture, _id]]] remoteExecCall ["ULP_fnc_invokeEvent", remoteExecutedOwner]; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_destroyVehicle.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_destroyVehicle.sqf index ba917f505..6ea22d107 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_destroyVehicle.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_destroyVehicle.sqf @@ -11,4 +11,4 @@ _this params [ if (_vehicleId isEqualTo -1) exitWith {}; -[format["UPDATE vehicles SET sold='1' WHERE id='%1'", [_vehicleId, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; \ No newline at end of file +[format["UPDATE `vehicles` SET `sold`='1' WHERE `id`='%1'", [_vehicleId, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_getGarage.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_getGarage.sqf index 244c758ea..523c2ef23 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_getGarage.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_getGarage.sqf @@ -19,7 +19,7 @@ if !(_steamid isEqualTo "" && { isClass (missionConfigFile >> "CfgFactions" >> _ format["'%1'", _x] }) joinString ", "; - private _query = [format["SELECT id, classname, type, texture, impound, faction FROM vehicles WHERE `type` IN (%1) AND pid='%2' AND faction='%3' AND active='0' AND sold='0' AND impound%4'0'", + private _query = [format["SELECT `id`, `classname`, `type`, `texture`, `impound`, `faction` FROM `vehicles` WHERE `type` IN (%1) AND `pid`='%2' AND `faction`='%3' AND `active`='0' AND `sold`='0' AND `impound`%4'0'", _types, _steamid, _faction, (["=", ">"] select (_impounded)) ], 2, true] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_isAtGarageLimit.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_isAtGarageLimit.sqf index 2358d7296..4d1fc07c9 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_isAtGarageLimit.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_isAtGarageLimit.sqf @@ -17,7 +17,7 @@ if (_ignoreGarageLimit) exitWith { false }; if (_className isEqualTo "" || { _steamId isEqualTo "" } || { _faction isEqualTo "" }) exitWith { true }; -private _query = [format["SELECT count(id) FROM vehicles WHERE pid='%1' AND classname='%2' AND faction='%3' AND sold='0'", _steamId, _className, _faction], 2] call DB_fnc_asyncCall; +private _query = [format["SELECT count(`id`) FROM `vehicles` WHERE `pid`='%1' AND `classname`='%2' AND `faction`='%3' AND `sold`='0'", _steamId, _className, _faction], 2] call DB_fnc_asyncCall; _query params [ ["_vehicleCount", 0, [0]] diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_retrieveVehicle.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_retrieveVehicle.sqf index d444a2ec5..ae4fda484 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_retrieveVehicle.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_retrieveVehicle.sqf @@ -14,6 +14,6 @@ if (_id < 0) exitWith {}; _id = [_id, ""] call ULP_fnc_numberText; [format[ - "UPDATE vehicles SET active='1', impound='0' WHERE id='%1'", + "UPDATE `vehicles` SET `active`='1', `impound`='0' WHERE `id`='%1'", _id ], 1] call DB_fnc_asyncCall; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_storeVehicle.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_storeVehicle.sqf index e380bc402..b1cdfb650 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_storeVehicle.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_storeVehicle.sqf @@ -16,7 +16,7 @@ private _id = _vehicle getVariable ["vehicle_id", -1]; if (_id < 0) exitWith {}; [format[ - "UPDATE vehicles SET active='0', impound='%2' WHERE id='%1'", + "UPDATE `vehicles` SET `active`='0', `impound`='%2' WHERE `id`='%1'", [_id, ""] call ULP_fnc_numberText, [_impoundFee, ""] call ULP_fnc_numberText ], 1] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/Vehicle/fn_transferVehicle.sqf b/Server Side/life_server/Functions/Database/Vehicle/fn_transferVehicle.sqf index caf80d6fc..5e1f3d601 100644 --- a/Server Side/life_server/Functions/Database/Vehicle/fn_transferVehicle.sqf +++ b/Server Side/life_server/Functions/Database/Vehicle/fn_transferVehicle.sqf @@ -31,5 +31,5 @@ if ([_className, _newSteamId, _faction, _hasVehicleCollectorPerk, _ignoreGarageL // The SQL has some failsafes with active, sold, and impound checks. Success message will still be sent // even if these are hit but we should've already stopped this client side just better to be safe than sorry -[format["UPDATE vehicles SET pid='%1' WHERE pid='%2' AND id='%3' AND active='0' AND sold='0' AND impound='0'", _newSteamId, _steamId, [_vehicleId, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; +[format["UPDATE `vehicles` SET `pid`='%1' WHERE `pid`='%2' AND `id`='%3' AND `active`='0' AND `sold`='0' AND `impound`='0'", _newSteamId, _steamId, [_vehicleId, ""] call ULP_fnc_numberText], 1] call DB_fnc_asyncCall; ["VehicleTransferred", []] remoteExecCall ["ULP_fnc_invokeEvent", remoteExecutedOwner]; \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Warrants/fn_addWarrant.sqf b/Server Side/life_server/Functions/Database/Warrants/fn_addWarrant.sqf index 4a596c758..d5b9b8eef 100644 --- a/Server Side/life_server/Functions/Database/Warrants/fn_addWarrant.sqf +++ b/Server Side/life_server/Functions/Database/Warrants/fn_addWarrant.sqf @@ -17,7 +17,7 @@ private _cfg = missionConfigFile >> "CfgWarrants" >> _act >> _crime; if (_pid isEqualTo "" || { !(isClass _cfg) }) exitWith { false }; [format[ - "INSERT INTO warrants (pid, act, crime, info) VALUES ('%1', '%2', '%3', '%4');", + "INSERT INTO `warrants` (`pid`, `act`, `crime`, `info`) VALUES ('%1', '%2', '%3', '%4');", _pid, _act, _crime, [[_handler, _note]] call DB_fnc_mresArray ], 1] call DB_fnc_asyncCall; true \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Warrants/fn_clearWarrants.sqf b/Server Side/life_server/Functions/Database/Warrants/fn_clearWarrants.sqf index f8dcf4cbb..dee412a0e 100644 --- a/Server Side/life_server/Functions/Database/Warrants/fn_clearWarrants.sqf +++ b/Server Side/life_server/Functions/Database/Warrants/fn_clearWarrants.sqf @@ -11,5 +11,5 @@ _this params [ if (_pid isEqualTo "") exitWith { false }; -[format["UPDATE warrants SET active='0' WHERE pid='%1' AND active='1'", _pid], 1] call DB_fnc_asyncCall; +[format["UPDATE `warrants` SET `active`='0' WHERE `pid`='%1' AND `active`='1'", _pid], 1] call DB_fnc_asyncCall; true \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Warrants/fn_deleteCrime.sqf b/Server Side/life_server/Functions/Database/Warrants/fn_deleteCrime.sqf index f2f6bd9ee..652fc59c3 100644 --- a/Server Side/life_server/Functions/Database/Warrants/fn_deleteCrime.sqf +++ b/Server Side/life_server/Functions/Database/Warrants/fn_deleteCrime.sqf @@ -14,5 +14,5 @@ _this params [ if (_pid isEqualTo "" || { _act isEqualTo "" } || { _crime isEqualTo "" } || { _crimeId isEqualTo -1 }) exitWith { false }; -[format["UPDATE warrants SET active='0' WHERE pid='%1' AND act='%2' AND crime='%3' AND id='%4' AND active='1'", _pid, _act, _crime, _crimeId], 1] call DB_fnc_asyncCall; +[format["UPDATE `warrants` SET `active`='0' WHERE `pid`='%1' AND `act`='%2' AND `crime`='%3' AND `id`='%4' AND `active`='1'", _pid, _act, _crime, _crimeId], 1] call DB_fnc_asyncCall; true \ No newline at end of file diff --git a/Server Side/life_server/Functions/Database/Warrants/fn_fetchWarrants.sqf b/Server Side/life_server/Functions/Database/Warrants/fn_fetchWarrants.sqf index a2668b374..261a35a56 100644 --- a/Server Side/life_server/Functions/Database/Warrants/fn_fetchWarrants.sqf +++ b/Server Side/life_server/Functions/Database/Warrants/fn_fetchWarrants.sqf @@ -9,7 +9,7 @@ private _units = ["Civilian"] call ULP_fnc_allMembers; private _warrants = createHashMap; if !(_units isEqualTo []) then { - private _warrants_query = [format ["SELECT * FROM warrants WHERE pid in (%1) AND active='1'", + private _warrants_query = [format ["SELECT * FROM `warrants` WHERE `pid` in (%1) AND `active`='1'", (_units apply { format ["'%1'", getPlayerUID _x] }) joinString "," ], 2, true] call DB_fnc_asyncCall; diff --git a/Server Side/life_server/Functions/Database/fn_getNextId.sqf b/Server Side/life_server/Functions/Database/fn_getNextId.sqf index 605bde296..5de60f840 100644 --- a/Server Side/life_server/Functions/Database/fn_getNextId.sqf +++ b/Server Side/life_server/Functions/Database/fn_getNextId.sqf @@ -1,13 +1,41 @@ /* ** Author: Jack "Scarso" Farhall ** Description: +** +** Usage: +** You must insert the entity using the id returned from this method to avoid auto increment resulting in a different value */ #include "\life_server\script_macros.hpp" scopeName "fn_getNextId"; _this params [ - ["_table", "", [""]] + ["_table", "", [""]], + ["_idColumn", "id", [""]] ]; -private _query = [format["SHOW TABLE STATUS LIKE '%1'", _table], 2] call DB_fnc_asyncCall; -(_query param [10, 1, [0]]) \ No newline at end of file +// I don't want to spend time refactoring to prepared statements to take advantage of their return insert id +// so this is a workaround to the table status not parsing correctly. Arma 3's basically dead so spending hours +// on this seems pointless. + +private _savedIds = missionNamespace getVariable ["ULP_SRV_NextIds", createHashMap]; + +private _nextId = _savedIds getOrDefault [_table, -1]; + +if (_nextId isEqualTo -1) then { + _nextId = ([format["SELECT MAX(%2) FROM `%1`", _table, _idColumn], 2] call DB_fnc_asyncCall) param [0, 1]; + + if !(isNil { ULP_DebugMode }) then { + [format["fn_getNextId: final id: '%1'", _nextId]] call ULP_fnc_logIt; + }; + + if (_nextId isEqualType "") then { + _nextId = parseNumber _nextId; + }; +}; + +_nextId = _nextId + 1; + +_savedIds set [_table, _nextId]; +missionNamespace setVariable ["ULP_SRV_NextIds", _savedIds]; + +_nextId \ No newline at end of file diff --git a/Server Side/life_server/Functions/Events/fn_initEvents.sqf b/Server Side/life_server/Functions/Events/fn_initEvents.sqf index ad9936450..9899e7cea 100644 --- a/Server Side/life_server/Functions/Events/fn_initEvents.sqf +++ b/Server Side/life_server/Functions/Events/fn_initEvents.sqf @@ -8,7 +8,21 @@ scopeName "fn_initEvents"; ["Adding Mission Events..."] call ULP_fnc_logIt; addMissionEventHandler ["EntityRespawned", { _this call ULP_SRV_fnc_onPlayerRespawn; }]; + addMissionEventHandler ["HandleDisconnect", { _this call ULP_SRV_fnc_onPlayerDisconnect; false }]; +addMissionEventHandler ["OnUserDisconnected", { + _this params [ + ["_networkId", "", [""]] + ]; + + // https://community.bistudio.com/wiki/getUserInfo - alt syntax + private _unit = _networkId getUserInfo 10; + + if (isNull _unit) exitWith {}; + + [_unit] call ULP_SRV_fnc_onPlayerDisconnect; +}]; + addMissionEventHandler ["EntityKilled", { _this params [ "_unit", "_killer" diff --git a/Server Side/life_server/Functions/Events/fn_onPlayerDisconnect.sqf b/Server Side/life_server/Functions/Events/fn_onPlayerDisconnect.sqf index 105d4a1d4..8e3119614 100644 --- a/Server Side/life_server/Functions/Events/fn_onPlayerDisconnect.sqf +++ b/Server Side/life_server/Functions/Events/fn_onPlayerDisconnect.sqf @@ -6,7 +6,7 @@ scopeName "fn_onPlayerDisconnect"; _this params [ - ["_unit", objNull, [objNull]], "", ["_uid", "", [""]] + ["_unit", objNull, [objNull]] ]; if (isNull _unit) exitWith {}; diff --git a/Server Side/life_server/Functions/Player/fn_unregisterSession.sqf b/Server Side/life_server/Functions/Player/fn_unregisterSession.sqf index c3f67457e..be4f40934 100644 --- a/Server Side/life_server/Functions/Player/fn_unregisterSession.sqf +++ b/Server Side/life_server/Functions/Player/fn_unregisterSession.sqf @@ -19,6 +19,14 @@ if (isNumber (_factionCfg >> "jointChannel") && { [getNumber(_factionCfg >> "joi ["Joint", _unit] call ULP_SRV_removeRadio; }; +// If they were downed wipe their gear +if (isDowned(_unit)) then { + private _cash = [_unit, "Cash"] call ULP_SRV_fnc_getSessionField; + + [_unit, 1, [0, _cash, false, "Disconnected while dead"]] call ULP_SRV_fnc_savePlayerState; // Remove Cash + [_unit, 15, []] call ULP_SRV_fnc_savePlayerState; // Remove Gear +}; + _unit setVariable ["session", nil]; _unit setVariable ["reputation", nil]; diff --git a/Server Side/life_server/config.cpp b/Server Side/life_server/config.cpp index 5b71895db..393dd6650 100644 --- a/Server Side/life_server/config.cpp +++ b/Server Side/life_server/config.cpp @@ -11,14 +11,14 @@ class CfgPatches { class Settings { class DonationGoal { type = "BOOL"; - default = false; + default = "0"; // Default should be in the format it would be saved in the database and use text type in config constant = true; global = true; }; class ThreatLevel { type = "NUMBER"; bounds[] = { 0, 4 }; // Number min / max... - default = 0; + default = "0"; constant = true; global = true; }; @@ -48,7 +48,7 @@ class CfgPatches { }; class Election { type = "BOOL"; - default = false; + default = "0"; constant = false; global = true; }; @@ -60,7 +60,7 @@ class CfgPatches { }; class BaseBidsActive { type = "BOOL"; - default = false; + default = "0"; constant = false; global = true; }; diff --git a/Server Side/life_server/fn_init.sqf b/Server Side/life_server/fn_init.sqf index b341e3f22..9c7ceb601 100644 --- a/Server Side/life_server/fn_init.sqf +++ b/Server Side/life_server/fn_init.sqf @@ -64,36 +64,38 @@ private _timeStamp = diag_tickTime; ["Getting Settings..."] call ULP_fnc_logIt; private _settings = ["SELECT * FROM settings", 2, true] call DB_fnc_asyncCall; +if (_settings isEqualTo "") then { _settings = []; }; -if !(_settings isEqualTo "" && { _settings isEqualTo [] }) then { - private _cfg = configFile >> "CfgPatches" >> "ULPServer" >> "Settings"; - { - _x params ["", "_name", "_value"]; - - if (isClass (_cfg >> _name)) then { - _value = switch (getText (_cfg >> _name >> "type")) do { - case "BOOL": { [parseNumber _value] call ULP_fnc_bool }; - CASE "NUMBER": { - _value = parseNumber _value; - if (isArray (_cfg >> _name >> "bounds")) exitWith { - private _bounds = getArray (_cfg >> _name >> "bounds"); - ((_value min (_bounds # 1)) max (_bounds # 0)) - }; - - _value - }; - case "ARRAY": { [_value] call DB_fnc_mresToArray }; - case "HASHMAP" : { createHashMapFromArray ([_value] call DB_fnc_mresToArray) }; - default { _value }; - }; +{ + private _cfg = _x; + + private _name = configName _x; - private _varName = format["ULP_SRV_Setting_%1", _name]; + // Attempt to get value from database or fallback to default + private _value = ((_settings select { (_x select 1) isEqualTo (configName _cfg) }) param [0, []]) param [2, getText (_x >> "default")]; + + _value = switch (getText (_x >> "type")) do { + case "BOOL": { [parseNumber _value] call ULP_fnc_bool }; + CASE "NUMBER": { + _value = parseNumber _value; + if (isArray (_x >> "bounds")) exitWith { + private _bounds = getArray (_x >> "bounds"); + ((_value min (_bounds # 1)) max (_bounds # 0)) + }; - missionNamespace setVariable [_varName, ([_value, [_varName, true, _value] call ULP_fnc_constant] select ([getNumber(_cfg >> _name >> "constant")] call ULP_fnc_bool)) - , [getNumber(_cfg >> _name >> "global")] call ULP_fnc_bool]; + _value }; - } forEach _settings; -}; + case "ARRAY": { [_value] call DB_fnc_mresToArray }; + case "HASHMAP" : { createHashMapFromArray ([_value] call DB_fnc_mresToArray) }; + default { _value }; + }; + + private _varName = format["ULP_SRV_Setting_%1", _name]; + + missionNamespace setVariable [_varName, + ([_value, [_varName, true, _value] call ULP_fnc_constant] select ([getNumber(_x >> "constant")] call ULP_fnc_bool)), + [getNumber(_x >> "global")] call ULP_fnc_bool]; +} forEach ("isClass _x" configClasses (configFile >> "CfgPatches" >> "ULPServer" >> "Settings")); ["Checking Election Information..."] call ULP_fnc_logIt; diff --git a/Server Side/life_server/script_macros.hpp b/Server Side/life_server/script_macros.hpp index 68e94279b..4768aa690 100644 --- a/Server Side/life_server/script_macros.hpp +++ b/Server Side/life_server/script_macros.hpp @@ -6,6 +6,8 @@ #define RCLIENT -2 //Except server #define RANY 0 //Global +#define isDowned(unit) unit getVariable ["isIncapacitated", false] + #define EXTDB "extDB3" callExtension #define EXTDB_SETTING(TYPE,SETTING) TYPE(missionConfigFile >> "CfgServer" >> SETTING) #define EXTDB_FAILED(MESSAGE) \