mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-02 19:28:52 +00:00
Merge pull request #86 from overextended/pr/ox
Update 1.5.0: Fixes across all of ESX Legacy
This commit is contained in:
+40
-40
@@ -2,7 +2,7 @@ CREATE TABLE `addon_account` (
|
||||
`name` varchar(60) NOT NULL,
|
||||
`label` varchar(100) NOT NULL,
|
||||
`shared` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `addon_account`
|
||||
@@ -28,7 +28,7 @@ CREATE TABLE `addon_account_data` (
|
||||
`account_name` varchar(100) DEFAULT NULL,
|
||||
`money` int(11) NOT NULL,
|
||||
`owner` varchar(60) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `addon_account_data`
|
||||
@@ -54,7 +54,7 @@ CREATE TABLE `addon_inventory` (
|
||||
`name` varchar(60) NOT NULL,
|
||||
`label` varchar(100) NOT NULL,
|
||||
`shared` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `addon_inventory`
|
||||
@@ -80,7 +80,7 @@ CREATE TABLE `addon_inventory_items` (
|
||||
`name` varchar(100) NOT NULL,
|
||||
`count` int(11) NOT NULL,
|
||||
`owner` varchar(60) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -90,13 +90,13 @@ CREATE TABLE `addon_inventory_items` (
|
||||
|
||||
CREATE TABLE `billing` (
|
||||
`id` int(11) NOT NULL,
|
||||
`identifier` varchar(60) DEFAULT NULL,
|
||||
`identifier` varchar(60) NOT NULL,
|
||||
`sender` varchar(40) NOT NULL,
|
||||
`target_type` varchar(50) NOT NULL,
|
||||
`target` varchar(40) NOT NULL,
|
||||
`label` varchar(255) NOT NULL,
|
||||
`amount` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -108,7 +108,7 @@ CREATE TABLE `cardealer_vehicles` (
|
||||
`id` int(11) NOT NULL,
|
||||
`vehicle` varchar(255) NOT NULL,
|
||||
`price` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -120,7 +120,7 @@ CREATE TABLE `datastore` (
|
||||
`name` varchar(60) NOT NULL,
|
||||
`label` varchar(100) NOT NULL,
|
||||
`shared` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `datastore`
|
||||
@@ -144,7 +144,7 @@ CREATE TABLE `datastore_data` (
|
||||
`name` varchar(60) NOT NULL,
|
||||
`owner` varchar(60) DEFAULT NULL,
|
||||
`data` longtext DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `datastore_data`
|
||||
@@ -169,7 +169,7 @@ CREATE TABLE `items` (
|
||||
`weight` int(11) NOT NULL DEFAULT 1,
|
||||
`rare` tinyint(4) NOT NULL DEFAULT 0,
|
||||
`can_remove` tinyint(4) NOT NULL DEFAULT 1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `items`
|
||||
@@ -219,7 +219,7 @@ CREATE TABLE `jobs` (
|
||||
`name` varchar(50) NOT NULL,
|
||||
`label` varchar(50) DEFAULT NULL,
|
||||
`whitelisted` tinyint(1) NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `jobs`
|
||||
@@ -255,7 +255,7 @@ CREATE TABLE `job_grades` (
|
||||
`salary` int(11) NOT NULL,
|
||||
`skin_male` longtext NOT NULL,
|
||||
`skin_female` longtext NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `job_grades`
|
||||
@@ -303,7 +303,7 @@ INSERT INTO `job_grades` (`id`, `job_name`, `grade`, `name`, `label`, `salary`,
|
||||
CREATE TABLE `licenses` (
|
||||
`type` varchar(60) NOT NULL,
|
||||
`label` varchar(60) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `licenses`
|
||||
@@ -320,11 +320,11 @@ INSERT INTO `licenses` (`type`, `label`) VALUES
|
||||
|
||||
CREATE TABLE `owned_properties` (
|
||||
`id` int(11) NOT NULL,
|
||||
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`price` double NOT NULL,
|
||||
`rented` int(11) NOT NULL,
|
||||
`owner` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
`owner` varchar(60) NOT NULL
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -339,7 +339,7 @@ CREATE TABLE `owned_vehicles` (
|
||||
`type` varchar(20) NOT NULL DEFAULT 'car',
|
||||
`job` varchar(20) DEFAULT NULL,
|
||||
`stored` tinyint(4) NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -351,20 +351,20 @@ CREATE TABLE `owned_vehicles` (
|
||||
|
||||
CREATE TABLE `properties` (
|
||||
`id` int(11) NOT NULL,
|
||||
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`entering` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`exit` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`inside` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`outside` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`ipls` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '[]',
|
||||
`gateway` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`label` varchar(255) DEFAULT NULL,
|
||||
`entering` varchar(255) DEFAULT NULL,
|
||||
`exit` varchar(255) DEFAULT NULL,
|
||||
`inside` varchar(255) DEFAULT NULL,
|
||||
`outside` varchar(255) DEFAULT NULL,
|
||||
`ipls` varchar(255) DEFAULT '[]',
|
||||
`gateway` varchar(255) DEFAULT NULL,
|
||||
`is_single` int(11) DEFAULT NULL,
|
||||
`is_room` int(11) DEFAULT NULL,
|
||||
`is_gateway` int(11) DEFAULT NULL,
|
||||
`room_menu` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`room_menu` varchar(255) DEFAULT NULL,
|
||||
`price` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `properties`
|
||||
@@ -457,7 +457,7 @@ CREATE TABLE `rented_vehicles` (
|
||||
`base_price` int(11) NOT NULL,
|
||||
`rent_price` int(11) NOT NULL,
|
||||
`owner` varchar(22) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `society_moneywash`
|
||||
@@ -468,7 +468,7 @@ CREATE TABLE `society_moneywash` (
|
||||
`identifier` varchar(60) NOT NULL,
|
||||
`society` varchar(60) NOT NULL,
|
||||
`amount` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -495,7 +495,7 @@ CREATE TABLE `users` (
|
||||
`is_dead` tinyint(1) DEFAULT 0,
|
||||
`id` int(11) NOT NULL,
|
||||
`last_property` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -506,8 +506,8 @@ CREATE TABLE `users` (
|
||||
CREATE TABLE `user_licenses` (
|
||||
`id` int(11) NOT NULL,
|
||||
`type` varchar(60) NOT NULL,
|
||||
`owner` varchar(60) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
`owner` varchar(60) NOT NULL
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -517,11 +517,11 @@ CREATE TABLE `user_licenses` (
|
||||
|
||||
CREATE TABLE `user_parkings` (
|
||||
`id` int(11) NOT NULL,
|
||||
`identifier` varchar(60) DEFAULT NULL,
|
||||
`identifier` varchar(60) NOT NULL,
|
||||
`garage` varchar(60) DEFAULT NULL,
|
||||
`zone` int(11) NOT NULL,
|
||||
`vehicle` longtext DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -534,7 +534,7 @@ CREATE TABLE `vehicles` (
|
||||
`model` varchar(60) NOT NULL,
|
||||
`price` int(11) NOT NULL,
|
||||
`category` varchar(60) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `vehicles`
|
||||
@@ -791,7 +791,7 @@ INSERT INTO `vehicles` (`name`, `model`, `price`, `category`) VALUES
|
||||
CREATE TABLE `vehicle_categories` (
|
||||
`name` varchar(60) NOT NULL,
|
||||
`label` varchar(60) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `vehicle_categories`
|
||||
@@ -822,7 +822,7 @@ CREATE TABLE `vehicle_sold` (
|
||||
`plate` varchar(50) NOT NULL,
|
||||
`soldby` varchar(50) NOT NULL,
|
||||
`date` varchar(50) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -835,7 +835,7 @@ CREATE TABLE `weashops` (
|
||||
`zone` varchar(255) NOT NULL,
|
||||
`item` varchar(255) NOT NULL,
|
||||
`price` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Dumping data for table `weashops`
|
||||
@@ -1140,7 +1140,7 @@ CREATE TABLE `user_contacts` (
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `index_user_contacts_identifier_name_number` (`identifier`, `name`, `number`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
ALTER TABLE `users`
|
||||
@@ -1157,7 +1157,7 @@ ALTER TABLE `users`
|
||||
`category` int DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO `fine_types` (label, amount, category) VALUES
|
||||
('Misuse of a horn', 30, 0),
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
--[[The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 IllidanS4
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
]]
|
||||
|
||||
local entityEnumerator = {
|
||||
__gc = function(enum)
|
||||
if enum.destructor and enum.handle then
|
||||
enum.destructor(enum.handle)
|
||||
end
|
||||
|
||||
enum.destructor = nil
|
||||
enum.handle = nil
|
||||
end
|
||||
}
|
||||
|
||||
local function EnumerateEntities(initFunc, moveFunc, disposeFunc)
|
||||
return coroutine.wrap(function()
|
||||
local iter, id = initFunc()
|
||||
if not id or id == 0 then
|
||||
disposeFunc(iter)
|
||||
return
|
||||
end
|
||||
|
||||
local enum = {handle = iter, destructor = disposeFunc}
|
||||
setmetatable(enum, entityEnumerator)
|
||||
local next = true
|
||||
|
||||
repeat
|
||||
coroutine.yield(id)
|
||||
next, id = moveFunc(iter)
|
||||
until not next
|
||||
|
||||
enum.destructor, enum.handle = nil, nil
|
||||
disposeFunc(iter)
|
||||
end)
|
||||
end
|
||||
|
||||
function EnumerateEntitiesWithinDistance(entities, isPlayerEntities, coords, maxDistance)
|
||||
local nearbyEntities = {}
|
||||
|
||||
if coords then
|
||||
coords = vector3(coords.x, coords.y, coords.z)
|
||||
else
|
||||
local playerPed = ESX.PlayerData.ped
|
||||
coords = GetEntityCoords(playerPed)
|
||||
end
|
||||
|
||||
for k,entity in pairs(entities) do
|
||||
local distance = #(coords - GetEntityCoords(entity))
|
||||
|
||||
if distance <= maxDistance then
|
||||
table.insert(nearbyEntities, isPlayerEntities and k or entity)
|
||||
end
|
||||
end
|
||||
|
||||
return nearbyEntities
|
||||
end
|
||||
|
||||
function EnumerateObjects()
|
||||
return EnumerateEntities(FindFirstObject, FindNextObject, EndFindObject)
|
||||
end
|
||||
|
||||
function EnumeratePeds()
|
||||
return EnumerateEntities(FindFirstPed, FindNextPed, EndFindPed)
|
||||
end
|
||||
|
||||
function EnumerateVehicles()
|
||||
return EnumerateEntities(FindFirstVehicle, FindNextVehicle, EndFindVehicle)
|
||||
end
|
||||
|
||||
function EnumeratePickups()
|
||||
return EnumerateEntities(FindFirstPickup, FindNextPickup, EndFindPickup)
|
||||
end
|
||||
@@ -21,7 +21,7 @@ ESX.Scaleform.Utils = {}
|
||||
|
||||
ESX.Streaming = {}
|
||||
|
||||
ESX.SetTimeout = function(msec, cb)
|
||||
function ESX.SetTimeout(msec, cb)
|
||||
table.insert(Core.TimeoutCallbacks, {
|
||||
time = GetGameTimer() + msec,
|
||||
cb = cb
|
||||
@@ -29,19 +29,45 @@ ESX.SetTimeout = function(msec, cb)
|
||||
return #Core.TimeoutCallbacks
|
||||
end
|
||||
|
||||
ESX.ClearTimeout = function(i)
|
||||
function ESX.ClearTimeout(i)
|
||||
Core.TimeoutCallbacks[i] = nil
|
||||
end
|
||||
|
||||
ESX.IsPlayerLoaded = function()
|
||||
function ESX.IsPlayerLoaded()
|
||||
return ESX.PlayerLoaded
|
||||
end
|
||||
|
||||
ESX.GetPlayerData = function()
|
||||
function ESX.GetPlayerData()
|
||||
return ESX.PlayerData
|
||||
end
|
||||
|
||||
ESX.SetPlayerData = function(key, val)
|
||||
function ESX.SearchInventory(items, count)
|
||||
if type(items) == 'string' then items = {items} end
|
||||
|
||||
local returnData = {}
|
||||
local itemCount = #items
|
||||
|
||||
for i = 1, itemCount do
|
||||
local itemName = items[i]
|
||||
returnData[itemName] = count and 0
|
||||
|
||||
for _, item in pairs(ESX.PlayerData.inventory) do
|
||||
if item.name == itemName then
|
||||
if count then
|
||||
returnData[itemName] = returnData[itemName] + item.count
|
||||
else
|
||||
returnData[itemName] = item
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if next(returnData) then
|
||||
return itemCount == 1 and returnData[items[1]] or returnData
|
||||
end
|
||||
end
|
||||
|
||||
function ESX.SetPlayerData(key, val)
|
||||
local current = ESX.PlayerData[key]
|
||||
ESX.PlayerData[key] = val
|
||||
if key ~= 'inventory' and key ~= 'loadout' then
|
||||
@@ -51,22 +77,22 @@ ESX.SetPlayerData = function(key, val)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.ShowNotification = function(msg)
|
||||
SetNotificationTextEntry('STRING')
|
||||
AddTextComponentString(msg)
|
||||
DrawNotification(0,1)
|
||||
function ESX.ShowNotification(msg)
|
||||
BeginTextCommandThefeedPost('STRING')
|
||||
AddTextComponentSubstringPlayerName(msg)
|
||||
EndTextCommandThefeedPostTicker(0,1)
|
||||
end
|
||||
|
||||
ESX.ShowAdvancedNotification = function(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex)
|
||||
function ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex)
|
||||
if saveToBrief == nil then saveToBrief = true end
|
||||
AddTextEntry('esxAdvancedNotification', msg)
|
||||
BeginTextCommandThefeedPost('esxAdvancedNotification')
|
||||
if hudColorIndex then ThefeedNextPostBackgroundColor(hudColorIndex) end
|
||||
if hudColorIndex then ThefeedSetNextPostBackgroundColor(hudColorIndex) end
|
||||
EndTextCommandThefeedPostMessagetext(textureDict, textureDict, false, iconType, sender, subject)
|
||||
EndTextCommandThefeedPostTicker(flash or false, saveToBrief)
|
||||
end
|
||||
|
||||
ESX.ShowHelpNotification = function(msg, thisFrame, beep, duration)
|
||||
function ESX.ShowHelpNotification(msg, thisFrame, beep, duration)
|
||||
AddTextEntry('esxHelpNotification', msg)
|
||||
|
||||
if thisFrame then
|
||||
@@ -78,7 +104,7 @@ ESX.ShowHelpNotification = function(msg, thisFrame, beep, duration)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.ShowFloatingHelpNotification = function(msg, coords)
|
||||
function ESX.ShowFloatingHelpNotification(msg, coords)
|
||||
AddTextEntry('esxFloatingHelpNotification', msg)
|
||||
SetFloatingHelpTextWorldPosition(1, coords)
|
||||
SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0)
|
||||
@@ -86,7 +112,7 @@ ESX.ShowFloatingHelpNotification = function(msg, coords)
|
||||
EndTextCommandDisplayHelp(2, false, false, -1)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback = function(name, cb, ...)
|
||||
function ESX.TriggerServerCallback(name, cb, ...)
|
||||
Core.ServerCallbacks[Core.CurrentRequestId] = cb
|
||||
|
||||
TriggerServerEvent('esx:triggerServerCallback', name, Core.CurrentRequestId, ...)
|
||||
@@ -98,14 +124,14 @@ ESX.TriggerServerCallback = function(name, cb, ...)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.HUD.SetDisplay = function(opacity)
|
||||
function ESX.UI.HUD.SetDisplay(opacity)
|
||||
SendNUIMessage({
|
||||
action = 'setHUDDisplay',
|
||||
opacity = opacity
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.HUD.RegisterElement = function(name, index, priority, html, data)
|
||||
function ESX.UI.HUD.RegisterElement(name, index, priority, html, data)
|
||||
local found = false
|
||||
|
||||
for i=1, #ESX.UI.HUD.RegisteredElements, 1 do
|
||||
@@ -133,7 +159,7 @@ ESX.UI.HUD.RegisterElement = function(name, index, priority, html, data)
|
||||
ESX.UI.HUD.UpdateElement(name, data)
|
||||
end
|
||||
|
||||
ESX.UI.HUD.RemoveElement = function(name)
|
||||
function ESX.UI.HUD.RemoveElement(name)
|
||||
for i=1, #ESX.UI.HUD.RegisteredElements, 1 do
|
||||
if ESX.UI.HUD.RegisteredElements[i] == name then
|
||||
table.remove(ESX.UI.HUD.RegisteredElements, i)
|
||||
@@ -147,14 +173,14 @@ ESX.UI.HUD.RemoveElement = function(name)
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.HUD.Reset = function()
|
||||
function ESX.UI.HUD.Reset()
|
||||
SendNUIMessage({
|
||||
action = 'resetHUDElements'
|
||||
})
|
||||
ESX.UI.HUD.RegisteredElements = {}
|
||||
end
|
||||
|
||||
ESX.UI.HUD.UpdateElement = function(name, data)
|
||||
function ESX.UI.HUD.UpdateElement(name, data)
|
||||
SendNUIMessage({
|
||||
action = 'updateHUDElement',
|
||||
name = name,
|
||||
@@ -162,14 +188,14 @@ ESX.UI.HUD.UpdateElement = function(name, data)
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.RegisterType = function(type, open, close)
|
||||
function ESX.UI.Menu.RegisterType(type, open, close)
|
||||
ESX.UI.Menu.RegisteredTypes[type] = {
|
||||
open = open,
|
||||
close = close
|
||||
}
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open = function(type, namespace, name, data, submit, cancel, change, close)
|
||||
function ESX.UI.Menu.Open(type, namespace, name, data, submit, cancel, change, close)
|
||||
local menu = {}
|
||||
|
||||
menu.type = type
|
||||
@@ -254,7 +280,7 @@ ESX.UI.Menu.Open = function(type, namespace, name, data, submit, cancel, change,
|
||||
return menu
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Close = function(type, namespace, name)
|
||||
function ESX.UI.Menu.Close(type, namespace, name)
|
||||
for i=1, #ESX.UI.Menu.Opened, 1 do
|
||||
if ESX.UI.Menu.Opened[i] then
|
||||
if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then
|
||||
@@ -265,7 +291,7 @@ ESX.UI.Menu.Close = function(type, namespace, name)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.Menu.CloseAll = function()
|
||||
function ESX.UI.Menu.CloseAll()
|
||||
for i=1, #ESX.UI.Menu.Opened, 1 do
|
||||
if ESX.UI.Menu.Opened[i] then
|
||||
ESX.UI.Menu.Opened[i].close()
|
||||
@@ -274,7 +300,7 @@ ESX.UI.Menu.CloseAll = function()
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.Menu.GetOpened = function(type, namespace, name)
|
||||
function ESX.UI.Menu.GetOpened(type, namespace, name)
|
||||
for i=1, #ESX.UI.Menu.Opened, 1 do
|
||||
if ESX.UI.Menu.Opened[i] then
|
||||
if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then
|
||||
@@ -284,15 +310,15 @@ ESX.UI.Menu.GetOpened = function(type, namespace, name)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.Menu.GetOpenedMenus = function()
|
||||
function ESX.UI.Menu.GetOpenedMenus()
|
||||
return ESX.UI.Menu.Opened
|
||||
end
|
||||
|
||||
ESX.UI.Menu.IsOpen = function(type, namespace, name)
|
||||
function ESX.UI.Menu.IsOpen(type, namespace, name)
|
||||
return ESX.UI.Menu.GetOpened(type, namespace, name) ~= nil
|
||||
end
|
||||
|
||||
ESX.UI.ShowInventoryItemNotification = function(add, item, count)
|
||||
function ESX.UI.ShowInventoryItemNotification(add, item, count)
|
||||
SendNUIMessage({
|
||||
action = 'inventoryNotification',
|
||||
add = add,
|
||||
@@ -301,7 +327,7 @@ ESX.UI.ShowInventoryItemNotification = function(add, item, count)
|
||||
})
|
||||
end
|
||||
|
||||
ESX.Game.GetPedMugshot = function(ped, transparent)
|
||||
function ESX.Game.GetPedMugshot(ped, transparent)
|
||||
if DoesEntityExist(ped) then
|
||||
local mugshot
|
||||
|
||||
@@ -321,7 +347,7 @@ ESX.Game.GetPedMugshot = function(ped, transparent)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.Game.Teleport = function(entity, coords, cb)
|
||||
function ESX.Game.Teleport(entity, coords, cb)
|
||||
local vector = type(coords) == "vector4" and coords or type(coords) == "vector3" and vector4(coords, 0.0) or vec(coords.x, coords.y, coords.z, coords.heading or 0.0)
|
||||
|
||||
if DoesEntityExist(entity) then
|
||||
@@ -339,7 +365,7 @@ ESX.Game.Teleport = function(entity, coords, cb)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.Game.SpawnObject = function(object, coords, cb, networked)
|
||||
function ESX.Game.SpawnObject(object, coords, cb, networked)
|
||||
local model = type(object) == 'number' and object or GetHashKey(object)
|
||||
local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
|
||||
networked = networked == nil and true or networked
|
||||
@@ -354,21 +380,21 @@ ESX.Game.SpawnObject = function(object, coords, cb, networked)
|
||||
end)
|
||||
end
|
||||
|
||||
ESX.Game.SpawnLocalObject = function(object, coords, cb)
|
||||
function ESX.Game.SpawnLocalObject(object, coords, cb)
|
||||
ESX.Game.SpawnObject(object, coords, cb, false)
|
||||
end
|
||||
|
||||
ESX.Game.DeleteVehicle = function(vehicle)
|
||||
function ESX.Game.DeleteVehicle(vehicle)
|
||||
SetEntityAsMissionEntity(vehicle, false, true)
|
||||
DeleteVehicle(vehicle)
|
||||
end
|
||||
|
||||
ESX.Game.DeleteObject = function(object)
|
||||
function ESX.Game.DeleteObject(object)
|
||||
SetEntityAsMissionEntity(object, false, true)
|
||||
DeleteObject(object)
|
||||
end
|
||||
|
||||
ESX.Game.SpawnVehicle = function(vehicle, coords, heading, cb, networked)
|
||||
function ESX.Game.SpawnVehicle(vehicle, coords, heading, cb, networked)
|
||||
local model = (type(vehicle) == 'number' and vehicle or GetHashKey(vehicle))
|
||||
local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
|
||||
networked = networked == nil and true or networked
|
||||
@@ -398,22 +424,22 @@ ESX.Game.SpawnVehicle = function(vehicle, coords, heading, cb, networked)
|
||||
end)
|
||||
end
|
||||
|
||||
ESX.Game.SpawnLocalVehicle = function(vehicle, coords, heading, cb)
|
||||
function ESX.Game.SpawnLocalVehicle(vehicle, coords, heading, cb)
|
||||
ESX.Game.SpawnVehicle(vehicle, coords, heading, cb, false)
|
||||
end
|
||||
|
||||
ESX.Game.IsVehicleEmpty = function(vehicle)
|
||||
function ESX.Game.IsVehicleEmpty(vehicle)
|
||||
local passengers = GetVehicleNumberOfPassengers(vehicle)
|
||||
local driverSeatFree = IsVehicleSeatFree(vehicle, -1)
|
||||
|
||||
return passengers == 0 and driverSeatFree
|
||||
end
|
||||
|
||||
ESX.Game.GetObjects = function() -- Leave the function for compatibility
|
||||
function ESX.Game.GetObjects() -- Leave the function for compatibility
|
||||
return GetGamePool('CObject')
|
||||
end
|
||||
|
||||
ESX.Game.GetPeds = function(onlyOtherPeds)
|
||||
function ESX.Game.GetPeds(onlyOtherPeds)
|
||||
local peds, myPed, pool = {}, ESX.PlayerData.ped, GetGamePool('CPed')
|
||||
|
||||
for i=1, #pool do
|
||||
@@ -425,11 +451,11 @@ ESX.Game.GetPeds = function(onlyOtherPeds)
|
||||
return peds
|
||||
end
|
||||
|
||||
ESX.Game.GetVehicles = function() -- Leave the function for compatibility
|
||||
function ESX.Game.GetVehicles() -- Leave the function for compatibility
|
||||
return GetGamePool('CVehicle')
|
||||
end
|
||||
|
||||
ESX.Game.GetPlayers = function(onlyOtherPlayers, returnKeyValue, returnPeds)
|
||||
function ESX.Game.GetPlayers(onlyOtherPlayers, returnKeyValue, returnPeds)
|
||||
local players, myPlayer = {}, PlayerId()
|
||||
|
||||
for k,player in ipairs(GetActivePlayers()) do
|
||||
@@ -447,36 +473,57 @@ ESX.Game.GetPlayers = function(onlyOtherPlayers, returnKeyValue, returnPeds)
|
||||
return players
|
||||
end
|
||||
|
||||
ESX.Game.GetClosestObject = function(coords, modelFilter)
|
||||
function ESX.Game.GetClosestObject(coords, modelFilter)
|
||||
return ESX.Game.GetClosestEntity(ESX.Game.GetObjects(), false, coords, modelFilter)
|
||||
end
|
||||
|
||||
ESX.Game.GetClosestPed = function(coords, modelFilter)
|
||||
function ESX.Game.GetClosestPed(coords, modelFilter)
|
||||
return ESX.Game.GetClosestEntity(ESX.Game.GetPeds(true), false, coords, modelFilter)
|
||||
end
|
||||
|
||||
ESX.Game.GetClosestPlayer = function(coords)
|
||||
function ESX.Game.GetClosestPlayer(coords)
|
||||
return ESX.Game.GetClosestEntity(ESX.Game.GetPlayers(true, true), true, coords, nil)
|
||||
end
|
||||
|
||||
ESX.Game.GetClosestVehicle = function(coords, modelFilter)
|
||||
function ESX.Game.GetClosestVehicle(coords, modelFilter)
|
||||
return ESX.Game.GetClosestEntity(ESX.Game.GetVehicles(), false, coords, modelFilter)
|
||||
end
|
||||
|
||||
ESX.Game.GetPlayersInArea = function(coords, maxDistance)
|
||||
local function EnumerateEntitiesWithinDistance(entities, isPlayerEntities, coords, maxDistance)
|
||||
local nearbyEntities = {}
|
||||
|
||||
if coords then
|
||||
coords = vector3(coords.x, coords.y, coords.z)
|
||||
else
|
||||
local playerPed = ESX.PlayerData.ped
|
||||
coords = GetEntityCoords(playerPed)
|
||||
end
|
||||
|
||||
for k,entity in pairs(entities) do
|
||||
local distance = #(coords - GetEntityCoords(entity))
|
||||
|
||||
if distance <= maxDistance then
|
||||
table.insert(nearbyEntities, isPlayerEntities and k or entity)
|
||||
end
|
||||
end
|
||||
|
||||
return nearbyEntities
|
||||
end
|
||||
|
||||
function ESX.Game.GetPlayersInArea(coords, maxDistance)
|
||||
return EnumerateEntitiesWithinDistance(ESX.Game.GetPlayers(true, true), true, coords, maxDistance)
|
||||
end
|
||||
|
||||
ESX.Game.GetVehiclesInArea = function(coords, maxDistance)
|
||||
function ESX.Game.GetVehiclesInArea(coords, maxDistance)
|
||||
return EnumerateEntitiesWithinDistance(ESX.Game.GetVehicles(), false, coords, maxDistance)
|
||||
end
|
||||
|
||||
ESX.Game.IsSpawnPointClear = function(coords, maxDistance)
|
||||
function ESX.Game.IsSpawnPointClear(coords, maxDistance)
|
||||
return #ESX.Game.GetVehiclesInArea(coords, maxDistance) == 0
|
||||
end
|
||||
|
||||
|
||||
ESX.Game.GetClosestEntity = function(entities, isPlayerEntities, coords, modelFilter)
|
||||
function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilter)
|
||||
local closestEntity, closestEntityDistance, filteredEntities = -1, -1, nil
|
||||
|
||||
if coords then
|
||||
@@ -507,11 +554,11 @@ ESX.Game.GetClosestEntity = function(entities, isPlayerEntities, coords, modelFi
|
||||
return closestEntity, closestEntityDistance
|
||||
end
|
||||
|
||||
ESX.Game.GetVehicleInDirection = function()
|
||||
function ESX.Game.GetVehicleInDirection()
|
||||
local playerPed = ESX.PlayerData.ped
|
||||
local playerCoords = GetEntityCoords(playerPed)
|
||||
local inDirection = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
|
||||
local rayHandle = StartShapeTestRay(playerCoords, inDirection, 10, playerPed, 0)
|
||||
local rayHandle = StartExpensiveSynchronousShapeTestLosProbe(playerCoords, inDirection, 10, playerPed, 0)
|
||||
local numRayHandle, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(rayHandle)
|
||||
|
||||
if hit == 1 and GetEntityType(entityHit) == 2 then
|
||||
@@ -522,7 +569,7 @@ ESX.Game.GetVehicleInDirection = function()
|
||||
return nil
|
||||
end
|
||||
|
||||
ESX.Game.GetVehicleProperties = function(vehicle)
|
||||
function ESX.Game.GetVehicleProperties(vehicle)
|
||||
if DoesEntityExist(vehicle) then
|
||||
local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
|
||||
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
||||
@@ -555,7 +602,7 @@ ESX.Game.GetVehicleProperties = function(vehicle)
|
||||
|
||||
wheels = GetVehicleWheelType(vehicle),
|
||||
windowTint = GetVehicleWindowTint(vehicle),
|
||||
xenonColor = GetVehicleXenonLightsColour(vehicle),
|
||||
xenonColor = GetVehicleXenonLightsColor(vehicle),
|
||||
|
||||
neonEnabled = {
|
||||
IsVehicleNeonLightEnabled(vehicle, 0),
|
||||
@@ -623,7 +670,7 @@ ESX.Game.GetVehicleProperties = function(vehicle)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.Game.SetVehicleProperties = function(vehicle, props)
|
||||
function ESX.Game.SetVehicleProperties(vehicle, props)
|
||||
if DoesEntityExist(vehicle) then
|
||||
local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
|
||||
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
||||
@@ -661,7 +708,7 @@ ESX.Game.SetVehicleProperties = function(vehicle, props)
|
||||
end
|
||||
|
||||
if props.neonColor then SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3]) end
|
||||
if props.xenonColor then SetVehicleXenonLightsColour(vehicle, props.xenonColor) end
|
||||
if props.xenonColor then SetVehicleXenonLightsColor(vehicle, props.xenonColor) end
|
||||
if props.modSmokeEnabled then ToggleVehicleMod(vehicle, 20, true) end
|
||||
if props.tyreSmokeColor then SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3]) end
|
||||
if props.modSpoilers then SetVehicleMod(vehicle, 0, props.modSpoilers, false) end
|
||||
@@ -715,10 +762,10 @@ ESX.Game.SetVehicleProperties = function(vehicle, props)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.Game.Utils.DrawText3D = function(coords, text, size, font)
|
||||
function ESX.Game.Utils.DrawText3D(coords, text, size, font)
|
||||
local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z)
|
||||
|
||||
local camCoords = GetGameplayCamCoords()
|
||||
local camCoords = GetFinalRenderedCamCoord()
|
||||
local distance = #(vector - camCoords)
|
||||
|
||||
if not size then size = 1 end
|
||||
@@ -732,15 +779,15 @@ ESX.Game.Utils.DrawText3D = function(coords, text, size, font)
|
||||
SetTextFont(font)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
BeginTextCommandDisplayText('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
SetDrawOrigin(vector.xyz, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
EndTextCommandDisplayText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
ESX.ShowInventory = function()
|
||||
function ESX.ShowInventory()
|
||||
local playerPed = ESX.PlayerData.ped
|
||||
local elements, currentWeight = {}, 0
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ CreateThread(function()
|
||||
if NetworkIsPlayerActive(PlayerId()) then
|
||||
exports.spawnmanager:setAutoSpawn(false)
|
||||
DoScreenFadeOut(0)
|
||||
Wait(500)
|
||||
TriggerServerEvent('esx:onPlayerJoined')
|
||||
break
|
||||
end
|
||||
@@ -517,7 +518,7 @@ AddEventHandler("esx:tpm", function()
|
||||
break
|
||||
end
|
||||
|
||||
Wait(5)
|
||||
Wait(0)
|
||||
end
|
||||
TriggerEvent('chatMessage', "Successfully Teleported")
|
||||
else
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
ESX.Scaleform.ShowFreemodeMessage = function(title, msg, sec)
|
||||
function ESX.Scaleform.ShowFreemodeMessage(title, msg, sec)
|
||||
local scaleform = ESX.Scaleform.Utils.RequestScaleformMovie('MP_BIG_MESSAGE_FREEMODE')
|
||||
|
||||
BeginScaleformMovieMethod(scaleform, 'SHOW_SHARD_WASTED_MP_MESSAGE')
|
||||
PushScaleformMovieMethodParameterString(title)
|
||||
PushScaleformMovieMethodParameterString(msg)
|
||||
ScaleformMovieMethodAddParamTextureNameString(title)
|
||||
ScaleformMovieMethodAddParamTextureNameString(msg)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -16,29 +16,29 @@ ESX.Scaleform.ShowFreemodeMessage = function(title, msg, sec)
|
||||
SetScaleformMovieAsNoLongerNeeded(scaleform)
|
||||
end
|
||||
|
||||
ESX.Scaleform.ShowBreakingNews = function(title, msg, bottom, sec)
|
||||
function ESX.Scaleform.ShowBreakingNews(title, msg, bottom, sec)
|
||||
local scaleform = ESX.Scaleform.Utils.RequestScaleformMovie('BREAKING_NEWS')
|
||||
|
||||
BeginScaleformMovieMethod(scaleform, 'SET_TEXT')
|
||||
PushScaleformMovieMethodParameterString(msg)
|
||||
PushScaleformMovieMethodParameterString(bottom)
|
||||
ScaleformMovieMethodAddParamTextureNameString(msg)
|
||||
ScaleformMovieMethodAddParamTextureNameString(bottom)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
BeginScaleformMovieMethod(scaleform, 'SET_SCROLL_TEXT')
|
||||
PushScaleformMovieMethodParameterInt(0) -- top ticker
|
||||
PushScaleformMovieMethodParameterInt(0) -- Since this is the first string, start at 0
|
||||
PushScaleformMovieMethodParameterString(title)
|
||||
ScaleformMovieMethodAddParamInt(0) -- top ticker
|
||||
ScaleformMovieMethodAddParamInt(0) -- Since this is the first string, start at 0
|
||||
ScaleformMovieMethodAddParamTextureNameString(title)
|
||||
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
BeginScaleformMovieMethod(scaleform, 'DISPLAY_SCROLL_TEXT')
|
||||
PushScaleformMovieMethodParameterInt(0) -- Top ticker
|
||||
PushScaleformMovieMethodParameterInt(0) -- Index of string
|
||||
ScaleformMovieMethodAddParamInt(0) -- Top ticker
|
||||
ScaleformMovieMethodAddParamInt(0) -- Index of string
|
||||
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -47,21 +47,21 @@ ESX.Scaleform.ShowBreakingNews = function(title, msg, bottom, sec)
|
||||
SetScaleformMovieAsNoLongerNeeded(scaleform)
|
||||
end
|
||||
|
||||
ESX.Scaleform.ShowPopupWarning = function(title, msg, bottom, sec)
|
||||
function ESX.Scaleform.ShowPopupWarning(title, msg, bottom, sec)
|
||||
local scaleform = ESX.Scaleform.Utils.RequestScaleformMovie('POPUP_WARNING')
|
||||
|
||||
BeginScaleformMovieMethod(scaleform, 'SHOW_POPUP_WARNING')
|
||||
|
||||
PushScaleformMovieMethodParameterFloat(500.0) -- black background
|
||||
PushScaleformMovieMethodParameterString(title)
|
||||
PushScaleformMovieMethodParameterString(msg)
|
||||
PushScaleformMovieMethodParameterString(bottom)
|
||||
PushScaleformMovieMethodParameterBool(true)
|
||||
ScaleformMovieMethodAddParamFloat(500.0) -- black background
|
||||
ScaleformMovieMethodAddParamTextureNameString(title)
|
||||
ScaleformMovieMethodAddParamTextureNameString(msg)
|
||||
ScaleformMovieMethodAddParamTextureNameString(bottom)
|
||||
ScaleformMovieMethodAddParamBool(true)
|
||||
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -70,7 +70,7 @@ ESX.Scaleform.ShowPopupWarning = function(title, msg, bottom, sec)
|
||||
SetScaleformMovieAsNoLongerNeeded(scaleform)
|
||||
end
|
||||
|
||||
ESX.Scaleform.ShowTrafficMovie = function(sec)
|
||||
function ESX.Scaleform.ShowTrafficMovie(sec)
|
||||
local scaleform = ESX.Scaleform.Utils.RequestScaleformMovie('TRAFFIC_CAM')
|
||||
|
||||
BeginScaleformMovieMethod(scaleform, 'PLAY_CAM_MOVIE')
|
||||
@@ -78,7 +78,7 @@ ESX.Scaleform.ShowTrafficMovie = function(sec)
|
||||
EndScaleformMovieMethod()
|
||||
|
||||
while sec > 0 do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
sec = sec - 0.01
|
||||
|
||||
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
|
||||
@@ -87,7 +87,7 @@ ESX.Scaleform.ShowTrafficMovie = function(sec)
|
||||
SetScaleformMovieAsNoLongerNeeded(scaleform)
|
||||
end
|
||||
|
||||
ESX.Scaleform.Utils.RequestScaleformMovie = function(movie)
|
||||
function ESX.Scaleform.Utils.RequestScaleformMovie(movie)
|
||||
local scaleform = RequestScaleformMovie(movie)
|
||||
|
||||
while not HasScaleformMovieLoaded(scaleform) do
|
||||
|
||||
@@ -5,7 +5,7 @@ function ESX.Streaming.RequestModel(modelHash, cb)
|
||||
RequestModel(modelHash)
|
||||
|
||||
while not HasModelLoaded(modelHash) do
|
||||
Wait(4)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ function ESX.Streaming.RequestStreamedTextureDict(textureDict, cb)
|
||||
RequestStreamedTextureDict(textureDict)
|
||||
|
||||
while not HasStreamedTextureDictLoaded(textureDict) do
|
||||
Wait(4)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ function ESX.Streaming.RequestNamedPtfxAsset(assetName, cb)
|
||||
RequestNamedPtfxAsset(assetName)
|
||||
|
||||
while not HasNamedPtfxAssetLoaded(assetName) do
|
||||
Wait(4)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ function ESX.Streaming.RequestAnimSet(animSet, cb)
|
||||
RequestAnimSet(animSet)
|
||||
|
||||
while not HasAnimSetLoaded(animSet) do
|
||||
Wait(4)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ function ESX.Streaming.RequestAnimDict(animDict, cb)
|
||||
RequestAnimDict(animDict)
|
||||
|
||||
while not HasAnimDictLoaded(animDict) do
|
||||
Wait(4)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ function ESX.Streaming.RequestWeaponAsset(weaponHash, cb)
|
||||
RequestWeaponAsset(weaponHash)
|
||||
|
||||
while not HasWeaponAssetLoaded(weaponHash) do
|
||||
Wait(4)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ for i = 48, 57 do table.insert(Charset, string.char(i)) end
|
||||
for i = 65, 90 do table.insert(Charset, string.char(i)) end
|
||||
for i = 97, 122 do table.insert(Charset, string.char(i)) end
|
||||
|
||||
ESX.GetRandomString = function(length)
|
||||
function ESX.GetRandomString(length)
|
||||
math.randomseed(GetGameTimer())
|
||||
|
||||
if length > 0 then
|
||||
@@ -14,11 +14,11 @@ ESX.GetRandomString = function(length)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetConfig = function()
|
||||
function ESX.GetConfig()
|
||||
return Config
|
||||
end
|
||||
|
||||
ESX.GetWeapon = function(weaponName)
|
||||
function ESX.GetWeapon(weaponName)
|
||||
weaponName = string.upper(weaponName)
|
||||
|
||||
for k,v in ipairs(Config.Weapons) do
|
||||
@@ -28,7 +28,7 @@ ESX.GetWeapon = function(weaponName)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetWeaponFromHash = function(weaponHash)
|
||||
function ESX.GetWeaponFromHash(weaponHash)
|
||||
for k,v in ipairs(Config.Weapons) do
|
||||
if GetHashKey(v.name) == weaponHash then
|
||||
return v
|
||||
@@ -36,11 +36,11 @@ ESX.GetWeaponFromHash = function(weaponHash)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetWeaponList = function()
|
||||
function ESX.GetWeaponList()
|
||||
return Config.Weapons
|
||||
end
|
||||
|
||||
ESX.GetWeaponLabel = function(weaponName)
|
||||
function ESX.GetWeaponLabel(weaponName)
|
||||
weaponName = string.upper(weaponName)
|
||||
|
||||
for k,v in ipairs(Config.Weapons) do
|
||||
@@ -50,7 +50,7 @@ ESX.GetWeaponLabel = function(weaponName)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetWeaponComponent = function(weaponName, weaponComponent)
|
||||
function ESX.GetWeaponComponent(weaponName, weaponComponent)
|
||||
weaponName = string.upper(weaponName)
|
||||
local weapons = Config.Weapons
|
||||
|
||||
@@ -65,7 +65,7 @@ ESX.GetWeaponComponent = function(weaponName, weaponComponent)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.DumpTable = function(table, nb)
|
||||
function ESX.DumpTable(table, nb)
|
||||
if nb == nil then
|
||||
nb = 0
|
||||
end
|
||||
@@ -95,6 +95,6 @@ ESX.DumpTable = function(table, nb)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.Round = function(value, numDecimalPlaces)
|
||||
function ESX.Round(value, numDecimalPlaces)
|
||||
return ESX.Math.Round(value, numDecimalPlaces)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ESX.Math = {}
|
||||
|
||||
ESX.Math.Round = function(value, numDecimalPlaces)
|
||||
function ESX.Math.Round(value, numDecimalPlaces)
|
||||
if numDecimalPlaces then
|
||||
local power = 10^numDecimalPlaces
|
||||
return math.floor((value * power) + 0.5) / (power)
|
||||
@@ -10,13 +10,13 @@ ESX.Math.Round = function(value, numDecimalPlaces)
|
||||
end
|
||||
|
||||
-- credit http://richard.warburton.it
|
||||
ESX.Math.GroupDigits = function(value)
|
||||
function ESX.Math.GroupDigits(value)
|
||||
local left,num,right = string.match(value,'^([^%d]*%d)(%d*)(.-)$')
|
||||
|
||||
return left..(num:reverse():gsub('(%d%d%d)','%1' .. _U('locale_digit_grouping_symbol')):reverse())..right
|
||||
end
|
||||
|
||||
ESX.Math.Trim = function(value)
|
||||
function ESX.Math.Trim(value)
|
||||
if value then
|
||||
return (string.gsub(value, "^%s*(.-)%s*$", "%1"))
|
||||
else
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
CREATE DATABASE IF NOT EXISTS `es_extended`;
|
||||
USE `es_extended`;
|
||||
|
||||
ALTER DATABASE `es_extended`
|
||||
DEFAULT CHARACTER SET UTF8MB4;
|
||||
|
||||
ALTER DATABASE `es_extended`
|
||||
DEFAULT COLLATE UTF8MB4_UNICODE_CI;
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`identifier` VARCHAR(60) NOT NULL,
|
||||
`accounts` LONGTEXT NULL DEFAULT NULL,
|
||||
@@ -12,7 +18,7 @@ CREATE TABLE `users` (
|
||||
`position` VARCHAR(255) NULL DEFAULT '{"x":-269.4,"y":-955.3,"z":31.2,"heading":205.8}',
|
||||
|
||||
PRIMARY KEY (`identifier`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
CREATE TABLE `items` (
|
||||
@@ -23,7 +29,7 @@ CREATE TABLE `items` (
|
||||
`can_remove` TINYINT NOT NULL DEFAULT 1,
|
||||
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
CREATE TABLE `job_grades` (
|
||||
@@ -37,7 +43,7 @@ CREATE TABLE `job_grades` (
|
||||
`skin_female` LONGTEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
INSERT INTO `job_grades` VALUES (1,'unemployed',0,'unemployed','Unemployed',200,'{}','{}');
|
||||
@@ -47,7 +53,7 @@ CREATE TABLE `jobs` (
|
||||
`label` VARCHAR(50) DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
INSERT INTO `jobs` VALUES ('unemployed','Unemployed');
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ES Extended'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_scripts {
|
||||
'locale.lua',
|
||||
@@ -31,7 +31,6 @@ server_scripts {
|
||||
|
||||
client_scripts {
|
||||
'client/common.lua',
|
||||
'client/entityiter.lua',
|
||||
'client/functions.lua',
|
||||
'client/wrapper.lua',
|
||||
'client/main.lua',
|
||||
|
||||
@@ -162,7 +162,7 @@ Locales['es'] = {
|
||||
-- SMG & LMG
|
||||
['weapon_assaultsmg'] = 'Subfusil de Asalto',
|
||||
['weapon_combatmg'] = 'Ametralladora de Combate',
|
||||
['weapon_combatmg'] = 'Ametralladora MK2',
|
||||
['weapon_combatmg_mk2'] = 'Ametralladora MK2',
|
||||
['weapon_combatpdw'] = 'Subfusil PDW',
|
||||
['weapon_gusenberg'] = 'Subfusil de Barril',
|
||||
['weapon_machinepistol'] = 'Pistola Ametralladora',
|
||||
|
||||
@@ -18,20 +18,20 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
|
||||
ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group))
|
||||
|
||||
self.triggerEvent = function(eventName, ...)
|
||||
function self.triggerEvent(eventName, ...)
|
||||
TriggerClientEvent(eventName, self.source, ...)
|
||||
end
|
||||
|
||||
self.setCoords = function(coords)
|
||||
function self.setCoords(coords)
|
||||
self.updateCoords(coords)
|
||||
self.triggerEvent('esx:teleport', coords)
|
||||
end
|
||||
|
||||
self.updateCoords = function(coords)
|
||||
function self.updateCoords(coords)
|
||||
self.coords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1), heading = ESX.Math.Round(coords.heading or 0.0, 1)}
|
||||
end
|
||||
|
||||
self.getCoords = function(vector)
|
||||
function self.getCoords(vector)
|
||||
if vector then
|
||||
return vector3(self.coords.x, self.coords.y, self.coords.z)
|
||||
else
|
||||
@@ -39,52 +39,52 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.kick = function(reason)
|
||||
function self.kick(reason)
|
||||
DropPlayer(self.source, reason)
|
||||
end
|
||||
|
||||
self.setMoney = function(money)
|
||||
function self.setMoney(money)
|
||||
money = ESX.Math.Round(money)
|
||||
self.setAccountMoney('money', money)
|
||||
end
|
||||
|
||||
self.getMoney = function()
|
||||
function self.getMoney()
|
||||
return self.getAccount('money').money
|
||||
end
|
||||
|
||||
self.addMoney = function(money)
|
||||
function self.addMoney(money)
|
||||
money = ESX.Math.Round(money)
|
||||
self.addAccountMoney('money', money)
|
||||
end
|
||||
|
||||
self.removeMoney = function(money)
|
||||
function self.removeMoney(money)
|
||||
money = ESX.Math.Round(money)
|
||||
self.removeAccountMoney('money', money)
|
||||
end
|
||||
|
||||
self.getIdentifier = function()
|
||||
function self.getIdentifier()
|
||||
return self.identifier
|
||||
end
|
||||
|
||||
self.setGroup = function(newGroup)
|
||||
function self.setGroup(newGroup)
|
||||
ExecuteCommand(('remove_principal identifier.%s group.%s'):format(self.license, self.group))
|
||||
self.group = newGroup
|
||||
ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group))
|
||||
end
|
||||
|
||||
self.getGroup = function()
|
||||
function self.getGroup()
|
||||
return self.group
|
||||
end
|
||||
|
||||
self.set = function(k, v)
|
||||
function self.set(k, v)
|
||||
self.variables[k] = v
|
||||
end
|
||||
|
||||
self.get = function(k)
|
||||
function self.get(k)
|
||||
return self.variables[k]
|
||||
end
|
||||
|
||||
self.getAccounts = function(minimal)
|
||||
function self.getAccounts(minimal)
|
||||
if minimal then
|
||||
local minimalAccounts = {}
|
||||
|
||||
@@ -98,7 +98,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getAccount = function(account)
|
||||
function self.getAccount(account)
|
||||
for k,v in ipairs(self.accounts) do
|
||||
if v.name == account then
|
||||
return v
|
||||
@@ -106,7 +106,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getInventory = function(minimal)
|
||||
function self.getInventory(minimal)
|
||||
if minimal then
|
||||
local minimalInventory = {}
|
||||
|
||||
@@ -122,11 +122,11 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getJob = function()
|
||||
function self.getJob()
|
||||
return self.job
|
||||
end
|
||||
|
||||
self.getLoadout = function(minimal)
|
||||
function self.getLoadout(minimal)
|
||||
if minimal then
|
||||
local minimalLoadout = {}
|
||||
|
||||
@@ -155,15 +155,15 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getName = function()
|
||||
function self.getName()
|
||||
return self.name
|
||||
end
|
||||
|
||||
self.setName = function(newName)
|
||||
function self.setName(newName)
|
||||
self.name = newName
|
||||
end
|
||||
|
||||
self.setAccountMoney = function(accountName, money)
|
||||
function self.setAccountMoney(accountName, money)
|
||||
if money >= 0 then
|
||||
local account = self.getAccount(accountName)
|
||||
|
||||
@@ -177,7 +177,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.addAccountMoney = function(accountName, money)
|
||||
function self.addAccountMoney(accountName, money)
|
||||
if money > 0 then
|
||||
local account = self.getAccount(accountName)
|
||||
|
||||
@@ -190,7 +190,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.removeAccountMoney = function(accountName, money)
|
||||
function self.removeAccountMoney(accountName, money)
|
||||
if money > 0 then
|
||||
local account = self.getAccount(accountName)
|
||||
|
||||
@@ -203,17 +203,15 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getInventoryItem = function(name)
|
||||
function self.getInventoryItem(name)
|
||||
for k,v in ipairs(self.inventory) do
|
||||
if v.name == name then
|
||||
return v
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
self.addInventoryItem = function(name, count)
|
||||
function self.addInventoryItem(name, count)
|
||||
local item = self.getInventoryItem(name)
|
||||
|
||||
if item then
|
||||
@@ -226,7 +224,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.removeInventoryItem = function(name, count)
|
||||
function self.removeInventoryItem(name, count)
|
||||
local item = self.getInventoryItem(name)
|
||||
|
||||
if item then
|
||||
@@ -243,7 +241,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.setInventoryItem = function(name, count)
|
||||
function self.setInventoryItem(name, count)
|
||||
local item = self.getInventoryItem(name)
|
||||
|
||||
if item and count >= 0 then
|
||||
@@ -257,22 +255,22 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getWeight = function()
|
||||
function self.getWeight()
|
||||
return self.weight
|
||||
end
|
||||
|
||||
self.getMaxWeight = function()
|
||||
function self.getMaxWeight()
|
||||
return self.maxWeight
|
||||
end
|
||||
|
||||
self.canCarryItem = function(name, count)
|
||||
function self.canCarryItem(name, count)
|
||||
local currentWeight, itemWeight = self.weight, ESX.Items[name].weight
|
||||
local newWeight = currentWeight + (itemWeight * count)
|
||||
|
||||
return newWeight <= self.maxWeight
|
||||
end
|
||||
|
||||
self.canSwapItem = function(firstItem, firstItemCount, testItem, testItemCount)
|
||||
function self.canSwapItem(firstItem, firstItemCount, testItem, testItemCount)
|
||||
local firstItemObject = self.getInventoryItem(firstItem)
|
||||
local testItemObject = self.getInventoryItem(testItem)
|
||||
|
||||
@@ -286,12 +284,12 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return false
|
||||
end
|
||||
|
||||
self.setMaxWeight = function(newWeight)
|
||||
function self.setMaxWeight(newWeight)
|
||||
self.maxWeight = newWeight
|
||||
self.triggerEvent('esx:setMaxWeight', self.maxWeight)
|
||||
end
|
||||
|
||||
self.setJob = function(job, grade)
|
||||
function self.setJob(job, grade)
|
||||
grade = tostring(grade)
|
||||
local lastJob = json.decode(json.encode(self.job))
|
||||
|
||||
@@ -326,7 +324,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.addWeapon = function(weaponName, ammo)
|
||||
function self.addWeapon(weaponName, ammo)
|
||||
if not self.hasWeapon(weaponName) then
|
||||
local weaponLabel = ESX.GetWeaponLabel(weaponName)
|
||||
|
||||
@@ -343,7 +341,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.addWeaponComponent = function(weaponName, weaponComponent)
|
||||
function self.addWeaponComponent(weaponName, weaponComponent)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -359,7 +357,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.addWeaponAmmo = function(weaponName, ammoCount)
|
||||
function self.addWeaponAmmo(weaponName, ammoCount)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -368,7 +366,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.updateWeaponAmmo = function(weaponName, ammoCount)
|
||||
function self.updateWeaponAmmo(weaponName, ammoCount)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -378,7 +376,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.setWeaponTint = function(weaponName, weaponTintIndex)
|
||||
function self.setWeaponTint(weaponName, weaponTintIndex)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -392,7 +390,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.getWeaponTint = function(weaponName)
|
||||
function self.getWeaponTint(weaponName)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -402,7 +400,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return 0
|
||||
end
|
||||
|
||||
self.removeWeapon = function(weaponName)
|
||||
function self.removeWeapon(weaponName)
|
||||
local weaponLabel
|
||||
|
||||
for k,v in ipairs(self.loadout) do
|
||||
@@ -424,7 +422,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.removeWeaponComponent = function(weaponName, weaponComponent)
|
||||
function self.removeWeaponComponent(weaponName, weaponComponent)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -446,7 +444,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.removeWeaponAmmo = function(weaponName, ammoCount)
|
||||
function self.removeWeaponAmmo(weaponName, ammoCount)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -455,7 +453,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.hasWeaponComponent = function(weaponName, weaponComponent)
|
||||
function self.hasWeaponComponent(weaponName, weaponComponent)
|
||||
local loadoutNum, weapon = self.getWeapon(weaponName)
|
||||
|
||||
if weapon then
|
||||
@@ -471,7 +469,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
self.hasWeapon = function(weaponName)
|
||||
function self.hasWeapon(weaponName)
|
||||
for k,v in ipairs(self.loadout) do
|
||||
if v.name == weaponName then
|
||||
return true
|
||||
@@ -481,21 +479,19 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return false
|
||||
end
|
||||
|
||||
self.getWeapon = function(weaponName)
|
||||
function self.getWeapon(weaponName)
|
||||
for k,v in ipairs(self.loadout) do
|
||||
if v.name == weaponName then
|
||||
return k, v
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
self.showNotification = function(msg)
|
||||
function self.showNotification(msg)
|
||||
self.triggerEvent('esx:showNotification', msg)
|
||||
end
|
||||
|
||||
self.showHelpNotification = function(msg, thisFrame, beep, duration)
|
||||
function self.showHelpNotification(msg, thisFrame, beep, duration)
|
||||
self.triggerEvent('esx:showHelpNotification', msg, thisFrame, beep, duration)
|
||||
end
|
||||
|
||||
|
||||
@@ -29,45 +29,62 @@ local function StartDBSync()
|
||||
end
|
||||
|
||||
MySQL.ready(function()
|
||||
MySQL.query('SELECT * FROM items', {}, function(result)
|
||||
for k,v in ipairs(result) do
|
||||
ESX.Items[v.name] = {
|
||||
label = v.label,
|
||||
weight = v.weight,
|
||||
rare = v.rare,
|
||||
canRemove = v.can_remove
|
||||
}
|
||||
end
|
||||
end)
|
||||
local items = MySQL.query.await('SELECT * FROM items')
|
||||
for k, v in ipairs(items) do
|
||||
ESX.Items[v.name] = {
|
||||
label = v.label,
|
||||
weight = v.weight,
|
||||
rare = v.rare,
|
||||
canRemove = v.can_remove
|
||||
}
|
||||
end
|
||||
|
||||
local Jobs = {}
|
||||
MySQL.query('SELECT * FROM jobs', {}, function(jobs)
|
||||
for k,v in ipairs(jobs) do
|
||||
Jobs[v.name] = v
|
||||
Jobs[v.name].grades = {}
|
||||
local jobs = MySQL.query.await('SELECT * FROM jobs')
|
||||
|
||||
for _, v in ipairs(jobs) do
|
||||
Jobs[v.name] = v
|
||||
Jobs[v.name].grades = {}
|
||||
end
|
||||
|
||||
local jobGrades = MySQL.query.await('SELECT * FROM job_grades')
|
||||
|
||||
for _, v in ipairs(jobGrades) do
|
||||
if Jobs[v.job_name] then
|
||||
Jobs[v.job_name].grades[tostring(v.grade)] = v
|
||||
else
|
||||
print(('[^3WARNING^7] Ignoring job grades for ^5"%s"^0 due to missing job'):format(v.job_name))
|
||||
end
|
||||
end
|
||||
|
||||
MySQL.query('SELECT * FROM job_grades', {}, function(jobGrades)
|
||||
for k,v in ipairs(jobGrades) do
|
||||
if Jobs[v.job_name] then
|
||||
Jobs[v.job_name].grades[tostring(v.grade)] = v
|
||||
else
|
||||
print(('[^3WARNING^7] Ignoring job grades for ^5"%s"^0 due to missing job'):format(v.job_name))
|
||||
end
|
||||
end
|
||||
for _, v in pairs(Jobs) do
|
||||
if ESX.Table.SizeOf(v.grades) == 0 then
|
||||
Jobs[v.name] = nil
|
||||
print(('[^3WARNING^7] Ignoring job ^5"%s"^0due to no job grades found'):format(v.name))
|
||||
end
|
||||
end
|
||||
|
||||
for k2,v2 in pairs(Jobs) do
|
||||
if ESX.Table.SizeOf(v2.grades) == 0 then
|
||||
Jobs[v2.name] = nil
|
||||
print(('[^3WARNING^7] Ignoring job ^5"%s"^0due to no job grades found'):format(v2.name))
|
||||
end
|
||||
end
|
||||
ESX.Jobs = Jobs
|
||||
print('[^2INFO^7] ESX ^5Legacy^0 initialized')
|
||||
StartDBSync()
|
||||
StartPayCheck()
|
||||
end)
|
||||
end)
|
||||
if not Jobs then
|
||||
-- Fallback data, if no jobs exist
|
||||
ESX.Jobs['unemployed'] = {
|
||||
label = 'Unemployed',
|
||||
grades = {
|
||||
['0'] = {
|
||||
grade = 0,
|
||||
label = 'Unemployed',
|
||||
salary = 200,
|
||||
skin_male = {},
|
||||
skin_female = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
ESX.Jobs = Jobs
|
||||
end
|
||||
|
||||
print('[^2INFO^7] ESX ^5Legacy^0 initialized')
|
||||
StartDBSync()
|
||||
StartPayCheck()
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx:clientLog')
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
ESX.Trace = function(msg)
|
||||
function ESX.Trace(msg)
|
||||
if Config.EnableDebug then
|
||||
print(('[^2TRACE^7] %s^7'):format(msg))
|
||||
end
|
||||
end
|
||||
|
||||
ESX.SetTimeout = function(msec, cb)
|
||||
function ESX.SetTimeout(msec, cb)
|
||||
local id = Core.TimeoutCount + 1
|
||||
|
||||
SetTimeout(msec, function()
|
||||
@@ -20,7 +20,7 @@ ESX.SetTimeout = function(msec, cb)
|
||||
return id
|
||||
end
|
||||
|
||||
ESX.RegisterCommand = function(name, group, cb, allowConsole, suggestion)
|
||||
function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
if type(name) == 'table' then
|
||||
for k,v in ipairs(name) do
|
||||
ESX.RegisterCommand(v, group, cb, allowConsole, suggestion)
|
||||
@@ -147,15 +147,15 @@ ESX.RegisterCommand = function(name, group, cb, allowConsole, suggestion)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.ClearTimeout = function(id)
|
||||
function ESX.ClearTimeout(id)
|
||||
Core.CancelledTimeouts[id] = true
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback = function(name, cb)
|
||||
function ESX.RegisterServerCallback(name, cb)
|
||||
Core.ServerCallbacks[name] = cb
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback = function(name, requestId, source, cb, ...)
|
||||
function ESX.TriggerServerCallback(name, requestId, source, cb, ...)
|
||||
if Core.ServerCallbacks[name] then
|
||||
Core.ServerCallbacks[name](source, cb, ...)
|
||||
else
|
||||
@@ -163,7 +163,7 @@ ESX.TriggerServerCallback = function(name, requestId, source, cb, ...)
|
||||
end
|
||||
end
|
||||
|
||||
Core.SavePlayer = function(xPlayer, cb)
|
||||
function Core.SavePlayer(xPlayer, cb)
|
||||
MySQL.prepare('UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ? WHERE `identifier` = ?', {
|
||||
json.encode(xPlayer.getAccounts(true)),
|
||||
xPlayer.job.name,
|
||||
@@ -181,7 +181,7 @@ Core.SavePlayer = function(xPlayer, cb)
|
||||
end)
|
||||
end
|
||||
|
||||
Core.SavePlayers = function(cb)
|
||||
function Core.SavePlayers(cb)
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
local count = #xPlayers
|
||||
if count > 0 then
|
||||
@@ -209,7 +209,7 @@ Core.SavePlayers = function(cb)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetPlayers = function()
|
||||
function ESX.GetPlayers()
|
||||
local sources = {}
|
||||
|
||||
for k,v in pairs(ESX.Players) do
|
||||
@@ -219,7 +219,7 @@ ESX.GetPlayers = function()
|
||||
return sources
|
||||
end
|
||||
|
||||
ESX.GetExtendedPlayers = function(key, val)
|
||||
function ESX.GetExtendedPlayers(key, val)
|
||||
local xPlayers = {}
|
||||
for k, v in pairs(ESX.Players) do
|
||||
if key then
|
||||
@@ -233,11 +233,11 @@ ESX.GetExtendedPlayers = function(key, val)
|
||||
return xPlayers
|
||||
end
|
||||
|
||||
ESX.GetPlayerFromId = function(source)
|
||||
function ESX.GetPlayerFromId(source)
|
||||
return ESX.Players[tonumber(source)]
|
||||
end
|
||||
|
||||
ESX.GetPlayerFromIdentifier = function(identifier)
|
||||
function ESX.GetPlayerFromIdentifier(identifier)
|
||||
for k,v in pairs(ESX.Players) do
|
||||
if v.identifier == identifier then
|
||||
return v
|
||||
@@ -245,7 +245,7 @@ ESX.GetPlayerFromIdentifier = function(identifier)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetIdentifier = function(playerId)
|
||||
function ESX.GetIdentifier(playerId)
|
||||
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
|
||||
if string.match(v, 'license:') then
|
||||
local identifier = string.gsub(v, 'license:', '')
|
||||
@@ -254,25 +254,25 @@ ESX.GetIdentifier = function(playerId)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.RegisterUsableItem = function(item, cb)
|
||||
function ESX.RegisterUsableItem(item, cb)
|
||||
Core.UsableItemsCallbacks[item] = cb
|
||||
end
|
||||
|
||||
ESX.UseItem = function(source, item)
|
||||
function ESX.UseItem(source, item)
|
||||
Core.UsableItemsCallbacks[item](source, item)
|
||||
end
|
||||
|
||||
ESX.GetItemLabel = function(item)
|
||||
function ESX.GetItemLabel(item)
|
||||
if ESX.Items[item] then
|
||||
return ESX.Items[item].label
|
||||
end
|
||||
end
|
||||
|
||||
ESX.GetJobs = function()
|
||||
function ESX.GetJobs()
|
||||
return ESX.Jobs
|
||||
end
|
||||
|
||||
ESX.GetUsableItems = function()
|
||||
function ESX.GetUsableItems()
|
||||
local Usables = {}
|
||||
for k in pairs(Core.UsableItemsCallbacks) do
|
||||
Usables[k] = true
|
||||
@@ -280,7 +280,7 @@ ESX.GetUsableItems = function()
|
||||
return Usables
|
||||
end
|
||||
|
||||
ESX.CreatePickup = function(type, name, count, label, playerId, components, tintIndex)
|
||||
function ESX.CreatePickup(type, name, count, label, playerId, components, tintIndex)
|
||||
local pickupId = (Core.PickupId == 65635 and 0 or Core.PickupId + 1)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
local coords = xPlayer.getCoords()
|
||||
@@ -300,7 +300,7 @@ ESX.CreatePickup = function(type, name, count, label, playerId, components, tint
|
||||
Core.PickupId = pickupId
|
||||
end
|
||||
|
||||
ESX.DoesJobExist = function(job, grade)
|
||||
function ESX.DoesJobExist(job, grade)
|
||||
grade = tostring(grade)
|
||||
|
||||
if job and grade then
|
||||
@@ -312,7 +312,7 @@ ESX.DoesJobExist = function(job, grade)
|
||||
return false
|
||||
end
|
||||
|
||||
Core.IsPlayerAdmin = function(playerId)
|
||||
function Core.IsPlayerAdmin(playerId)
|
||||
if (IsPlayerAceAllowed(playerId, 'command') or GetConvar('sv_lan', '') == 'true') and true or false then
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -16,6 +16,8 @@ loadPlayer = loadPlayer..' FROM `users` WHERE identifier = ?'
|
||||
|
||||
if Config.Multichar then
|
||||
AddEventHandler('esx:onPlayerJoined', function(src, char, data)
|
||||
while not next(ESX.Jobs) do Wait(50) end
|
||||
|
||||
if not ESX.Players[src] then
|
||||
local identifier = char..':'..ESX.GetIdentifier(src)
|
||||
if data then
|
||||
@@ -28,6 +30,8 @@ if Config.Multichar then
|
||||
else
|
||||
RegisterNetEvent('esx:onPlayerJoined')
|
||||
AddEventHandler('esx:onPlayerJoined', function()
|
||||
while not next(ESX.Jobs) do Wait(50) end
|
||||
|
||||
if not ESX.Players[source] then
|
||||
onPlayerJoined(source)
|
||||
end
|
||||
@@ -306,7 +310,7 @@ if Config.Multichar then
|
||||
AddEventHandler('esx:playerLogout', function(playerId)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
if xPlayer then
|
||||
TriggerEvent('esx:playerDropped', playerId, reason)
|
||||
TriggerEvent('esx:playerDropped', playerId)
|
||||
|
||||
Core.SavePlayer(xPlayer, function()
|
||||
ESX.Players[playerId] = nil
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
StartPayCheck = function()
|
||||
function StartPayCheck()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(Config.PaycheckInterval)
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Identity'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ if Config.UseDeferrals then
|
||||
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
|
||||
end
|
||||
|
||||
Wait(5)
|
||||
Wait(0)
|
||||
alreadyRegistered[xPlayer.identifier] = true
|
||||
TriggerClientEvent('esx_identity:alreadyRegistered', xPlayer.source)
|
||||
|
||||
@@ -142,7 +142,7 @@ elseif not Config.UseDeferrals then
|
||||
Wait(300)
|
||||
|
||||
while not ESX do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
local xPlayers = ESX.GetExtendedPlayers()
|
||||
@@ -170,7 +170,7 @@ elseif not Config.UseDeferrals then
|
||||
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
|
||||
end
|
||||
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
TriggerClientEvent('esx_identity:alreadyRegistered', xPlayer.source)
|
||||
|
||||
playerIdentity[xPlayer.identifier] = nil
|
||||
@@ -223,7 +223,7 @@ elseif not Config.UseDeferrals then
|
||||
end)
|
||||
|
||||
function checkIdentity(xPlayer)
|
||||
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {identifier},
|
||||
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', { xPlayer.identifier },
|
||||
function(result)
|
||||
if result then
|
||||
if result.firstname then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local GUI, MenuType = {}, 'default'
|
||||
GUI.Time = 0
|
||||
|
||||
local openMenu = function(namespace, name, data)
|
||||
local function openMenu(namespace, name, data)
|
||||
SendNUIMessage({
|
||||
action = 'openMenu',
|
||||
namespace = namespace,
|
||||
@@ -10,12 +10,11 @@ local openMenu = function(namespace, name, data)
|
||||
})
|
||||
end
|
||||
|
||||
local closeMenu = function(namespace, name)
|
||||
local function closeMenu(namespace, name)
|
||||
SendNUIMessage({
|
||||
action = 'closeMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
end
|
||||
|
||||
@@ -61,32 +60,32 @@ CreateThread(function()
|
||||
while true do
|
||||
Wait(15)
|
||||
|
||||
if IsControlPressed(0, 18) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
if IsControlPressed(0, 18) and IsUsingKeyboard(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'ENTER'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 177) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
if IsControlPressed(0, 177) and IsUsingKeyboard(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'BACKSPACE'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 27) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
if IsControlPressed(0, 27) and IsUsingKeyboard(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'TOP'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 173) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
if IsControlPressed(0, 173) and IsUsingKeyboard(0) and (GetGameTimer() - GUI.Time) > 200 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'DOWN'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 174) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
if IsControlPressed(0, 174) and IsUsingKeyboard(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'LEFT'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
if IsControlPressed(0, 175) and IsInputDisabled(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
if IsControlPressed(0, 175) and IsUsingKeyboard(0) and (GetGameTimer() - GUI.Time) > 150 then
|
||||
SendNUIMessage({action = 'controlPressed', control = 'RIGHT'})
|
||||
GUI.Time = GetGameTimer()
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Menu Default'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local Timeouts, OpenedMenus, MenuType = {}, {}, 'dialog'
|
||||
|
||||
local openMenu = function(namespace, name, data)
|
||||
local function openMenu(namespace, name, data)
|
||||
for i=1, #Timeouts, 1 do
|
||||
ESX.ClearTimeout(Timeouts[i])
|
||||
end
|
||||
@@ -21,14 +21,13 @@ local openMenu = function(namespace, name, data)
|
||||
table.insert(Timeouts, timeoutId)
|
||||
end
|
||||
|
||||
local closeMenu = function(namespace, name)
|
||||
local function closeMenu(namespace, name)
|
||||
OpenedMenus[namespace .. '_' .. name] = nil
|
||||
|
||||
SendNUIMessage({
|
||||
action = 'closeMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
|
||||
if ESX.Table.SizeOf(OpenedMenus) == 0 then
|
||||
@@ -83,7 +82,7 @@ end)
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
|
||||
if ESX.Table.SizeOf(OpenedMenus) > 0 then
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Menu Dialog'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -2,7 +2,7 @@ CreateThread(function()
|
||||
local MenuType = 'list'
|
||||
local OpenedMenus = {}
|
||||
|
||||
local openMenu = function(namespace, name, data)
|
||||
local function openMenu(namespace, name, data)
|
||||
|
||||
OpenedMenus[namespace .. '_' .. name] = true
|
||||
|
||||
@@ -19,7 +19,7 @@ CreateThread(function()
|
||||
|
||||
end
|
||||
|
||||
local closeMenu = function(namespace, name)
|
||||
local function closeMenu(namespace, name)
|
||||
|
||||
OpenedMenus[namespace .. '_' .. name] = nil
|
||||
local OpenedMenuCount = 0
|
||||
@@ -28,7 +28,6 @@ CreateThread(function()
|
||||
action = 'closeMenu',
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
|
||||
for k,v in pairs(OpenedMenus) do
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Menu List'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Skin'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -165,9 +165,9 @@ function GetMaxVals()
|
||||
chin_3 = 10,
|
||||
chin_4 = 10,
|
||||
neck_thickness = 10,
|
||||
age_1 = GetNumHeadOverlayValues(3)-1,
|
||||
age_1 = GetPedHeadOverlayNum(3)-1,
|
||||
age_2 = 10,
|
||||
beard_1 = GetNumHeadOverlayValues(1)-1,
|
||||
beard_1 = GetPedHeadOverlayNum(1)-1,
|
||||
beard_2 = 10,
|
||||
beard_3 = GetNumHairColors()-1,
|
||||
beard_4 = GetNumHairColors()-1,
|
||||
@@ -177,37 +177,37 @@ function GetMaxVals()
|
||||
hair_color_2 = GetNumHairColors()-1,
|
||||
eye_color = 31,
|
||||
eye_squint = 10,
|
||||
eyebrows_1 = GetNumHeadOverlayValues(2)-1,
|
||||
eyebrows_1 = GetPedHeadOverlayNum(2)-1,
|
||||
eyebrows_2 = 10,
|
||||
eyebrows_3 = GetNumHairColors()-1,
|
||||
eyebrows_4 = GetNumHairColors()-1,
|
||||
eyebrows_5 = 10,
|
||||
eyebrows_6 = 10,
|
||||
makeup_1 = GetNumHeadOverlayValues(4)-1,
|
||||
makeup_1 = GetPedHeadOverlayNum(4)-1,
|
||||
makeup_2 = 10,
|
||||
makeup_3 = GetNumHairColors()-1,
|
||||
makeup_4 = GetNumHairColors()-1,
|
||||
lipstick_1 = GetNumHeadOverlayValues(8)-1,
|
||||
lipstick_1 = GetPedHeadOverlayNum(8)-1,
|
||||
lipstick_2 = 10,
|
||||
lipstick_3 = GetNumHairColors()-1,
|
||||
lipstick_4 = GetNumHairColors()-1,
|
||||
blemishes_1 = GetNumHeadOverlayValues(0)-1,
|
||||
blemishes_1 = GetPedHeadOverlayNum(0)-1,
|
||||
blemishes_2 = 10,
|
||||
blush_1 = GetNumHeadOverlayValues(5)-1,
|
||||
blush_1 = GetPedHeadOverlayNum(5)-1,
|
||||
blush_2 = 10,
|
||||
blush_3 = GetNumHairColors()-1,
|
||||
complexion_1 = GetNumHeadOverlayValues(6)-1,
|
||||
complexion_1 = GetPedHeadOverlayNum(6)-1,
|
||||
complexion_2 = 10,
|
||||
sun_1 = GetNumHeadOverlayValues(7)-1,
|
||||
sun_1 = GetPedHeadOverlayNum(7)-1,
|
||||
sun_2 = 10,
|
||||
moles_1 = GetNumHeadOverlayValues(9)-1,
|
||||
moles_1 = GetPedHeadOverlayNum(9)-1,
|
||||
moles_2 = 10,
|
||||
chest_1 = GetNumHeadOverlayValues(10)-1,
|
||||
chest_1 = GetPedHeadOverlayNum(10)-1,
|
||||
chest_2 = 10,
|
||||
chest_3 = GetNumHairColors()-1,
|
||||
bodyb_1 = GetNumHeadOverlayValues(11)-1,
|
||||
bodyb_1 = GetPedHeadOverlayNum(11)-1,
|
||||
bodyb_2 = 10,
|
||||
bodyb_3 = GetNumHeadOverlayValues(12)-1,
|
||||
bodyb_3 = GetPedHeadOverlayNum(12)-1,
|
||||
bodyb_4 = 10,
|
||||
ears_1 = GetNumberOfPedPropDrawableVariations (playerPed, 2) - 1,
|
||||
ears_2 = GetNumberOfPedPropTextureVariations (playerPed, 2, Character['ears_1'] - 1),
|
||||
@@ -356,7 +356,7 @@ function ApplySkin(skin, clothes)
|
||||
SetPedHeadOverlay (playerPed, 3, Character['age_1'], (Character['age_2'] / 10) + 0.0) -- Age + opacity
|
||||
SetPedHeadOverlay (playerPed, 0, Character['blemishes_1'], (Character['blemishes_2'] / 10) + 0.0) -- Blemishes + opacity
|
||||
SetPedHeadOverlay (playerPed, 1, Character['beard_1'], (Character['beard_2'] / 10) + 0.0) -- Beard + opacity
|
||||
SetPedEyeColor (playerPed, Character['eye_color'], 0, 1) -- Eyes color
|
||||
SetPedEyeColor (playerPed, Character['eye_color']) -- Eyes color
|
||||
SetPedHeadOverlay (playerPed, 2, Character['eyebrows_1'], (Character['eyebrows_2'] / 10) + 0.0) -- Eyebrows + opacity
|
||||
SetPedHeadOverlay (playerPed, 4, Character['makeup_1'], (Character['makeup_2'] / 10) + 0.0) -- Makeup + opacity
|
||||
SetPedHeadOverlay (playerPed, 8, Character['lipstick_1'], (Character['lipstick_2'] / 10) + 0.0) -- Lipstick + opacity
|
||||
|
||||
@@ -145,7 +145,7 @@ CreateThread(function()
|
||||
SetBlipAsShortRange(blip, true)
|
||||
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString(_U('shop', _U(string.lower(k))))
|
||||
AddTextComponentSubstringPlayerName(_U('shop', _U(string.lower(k))))
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
end
|
||||
@@ -222,7 +222,7 @@ CreateThread(function()
|
||||
end
|
||||
|
||||
if Config.EnableControls then
|
||||
if IsControlJustReleased(0, 311) and IsInputDisabled(0) and not ESX.PlayerData.dead then
|
||||
if IsControlJustReleased(0, 311) and IsUsingKeyboard(0) and not ESX.PlayerData.dead then
|
||||
OpenAccessoryMenu()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Accessories'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ end)
|
||||
|
||||
RegisterServerEvent('esx_accessories:save')
|
||||
AddEventHandler('esx_accessories:save', function(skin, accessory)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_datastore:getDataStore', 'user_' .. string.lower(accessory), xPlayer.identifier, function(store)
|
||||
store.set('has' .. accessory, true)
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Addon Account'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
server_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -5,22 +5,22 @@ function CreateAddonAccount(name, owner, money)
|
||||
self.owner = owner
|
||||
self.money = money
|
||||
|
||||
self.addMoney = function(m)
|
||||
function self.addMoney(m)
|
||||
self.money = self.money + m
|
||||
self.save()
|
||||
end
|
||||
|
||||
self.removeMoney = function(m)
|
||||
function self.removeMoney(m)
|
||||
self.money = self.money - m
|
||||
self.save()
|
||||
end
|
||||
|
||||
self.setMoney = function(m)
|
||||
function self.setMoney(m)
|
||||
self.money = m
|
||||
self.save()
|
||||
end
|
||||
|
||||
self.save = function()
|
||||
function self.save()
|
||||
if self.owner == nil then
|
||||
MySQL.update('UPDATE addon_account_data SET money = ? WHERE account_name = ?', {self.money, self.name})
|
||||
else
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Addon Inventory'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
server_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -5,28 +5,28 @@ function CreateAddonInventory(name, owner, items)
|
||||
self.owner = owner
|
||||
self.items = items
|
||||
|
||||
self.addItem = function(name, count)
|
||||
function self.addItem(name, count)
|
||||
local item = self.getItem(name)
|
||||
item.count = item.count + count
|
||||
Wait(100)
|
||||
self.saveItem(name, item.count)
|
||||
end
|
||||
|
||||
self.removeItem = function(name, count)
|
||||
function self.removeItem(name, count)
|
||||
local item = self.getItem(name)
|
||||
item.count = item.count - count
|
||||
|
||||
self.saveItem(name, item.count)
|
||||
end
|
||||
|
||||
self.setItem = function(name, count)
|
||||
function self.setItem(name, count)
|
||||
local item = self.getItem(name)
|
||||
item.count = count
|
||||
|
||||
self.saveItem(name, item.count)
|
||||
end
|
||||
|
||||
self.getItem = function(name)
|
||||
function self.getItem(name)
|
||||
for i=1, #self.items, 1 do
|
||||
if self.items[i].name == name then
|
||||
return self.items[i]
|
||||
@@ -61,7 +61,7 @@ function CreateAddonInventory(name, owner, items)
|
||||
return item
|
||||
end
|
||||
|
||||
self.saveItem = function(name, count)
|
||||
function self.saveItem(name, count)
|
||||
if self.owner == nil then
|
||||
MySQL.update('UPDATE addon_inventory_items SET count = @count WHERE inventory_name = @inventory_name AND name = @item_name', {
|
||||
['@inventory_name'] = self.name,
|
||||
|
||||
@@ -116,7 +116,7 @@ function OnPlayerDeath()
|
||||
StartDeathTimer()
|
||||
StartDistressSignal()
|
||||
|
||||
StartScreenEffect('DeathFailOut', 0, false)
|
||||
AnimpostfxPlay('DeathFailOut', 0, false)
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx_ambulancejob:useItem')
|
||||
@@ -258,10 +258,9 @@ function StartDeathTimer()
|
||||
text = _U('respawn_available_in', secondsToClock(earlySpawnTimer))
|
||||
|
||||
DrawGenericTextThisFrame()
|
||||
|
||||
SetTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawText(0.5, 0.8)
|
||||
BeginTextCommandDisplayText('STRING')
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
EndTextCommandDisplayText(0.5, 0.8)
|
||||
end
|
||||
|
||||
-- bleedout timer
|
||||
@@ -294,9 +293,9 @@ function StartDeathTimer()
|
||||
|
||||
DrawGenericTextThisFrame()
|
||||
|
||||
SetTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawText(0.5, 0.8)
|
||||
BeginTextCommandDisplayText('STRING')
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
EndTextCommandDisplayText(0.5, 0.8)
|
||||
end
|
||||
|
||||
if bleedoutTimer < 1 and isDead then
|
||||
@@ -312,7 +311,7 @@ function RemoveItemsAfterRPDeath()
|
||||
DoScreenFadeOut(800)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function()
|
||||
@@ -325,14 +324,14 @@ function RemoveItemsAfterRPDeath()
|
||||
ESX.SetPlayerData('loadout', {})
|
||||
RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading)
|
||||
|
||||
StopScreenEffect('DeathFailOut')
|
||||
AnimpostfxStop('DeathFailOut')
|
||||
DoScreenFadeIn(800)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function RespawnPed(ped, coords, heading)
|
||||
SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true)
|
||||
SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false)
|
||||
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false)
|
||||
SetPlayerInvincible(ped, false)
|
||||
ClearPedBloodDamage(ped)
|
||||
@@ -377,7 +376,7 @@ AddEventHandler('esx_ambulancejob:revive', function()
|
||||
|
||||
RespawnPed(playerPed, formattedCoords, 0.0)
|
||||
|
||||
StopScreenEffect('DeathFailOut')
|
||||
AnimpostfxStop('DeathFailOut')
|
||||
DoScreenFadeIn(800)
|
||||
end)
|
||||
|
||||
|
||||
@@ -135,10 +135,15 @@ function StoreNearbyVehicle(playerCoords)
|
||||
isBusy = true
|
||||
|
||||
CreateThread(function()
|
||||
BeginTextCommandBusyspinnerOn('STRING')
|
||||
AddTextComponentSubstringPlayerName(_U('garage_storing'))
|
||||
EndTextCommandBusyspinnerOn(4)
|
||||
|
||||
while isBusy do
|
||||
Wait(0)
|
||||
drawLoadingText(_U('garage_storing'), 255, 255, 255, 255)
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
BusyspinnerOff()
|
||||
end)
|
||||
|
||||
-- Workaround for vehicle not deleting when other players are near it.
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Ambulance Job'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Animations'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -37,7 +37,7 @@ CreateThread(function()
|
||||
SetBlipColour(ATMLocation.blip, 2)
|
||||
SetBlipAsShortRange(ATMLocation.blip, true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString(_U('atm_blip'))
|
||||
AddTextComponentSubstringPlayerName(_U('atm_blip'))
|
||||
EndTextCommandSetBlipName(ATMLocation.blip)
|
||||
end
|
||||
end)
|
||||
@@ -45,7 +45,7 @@ end)
|
||||
-- Activate menu when player is inside marker
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local canSleep = true
|
||||
isInATMMarker = false
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Atm'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
RegisterServerEvent('esx_atm:deposit')
|
||||
AddEventHandler('esx_atm:deposit', function(amount)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
amount = tonumber(amount)
|
||||
|
||||
if not tonumber(amount) then return end
|
||||
@@ -18,8 +18,8 @@ end)
|
||||
|
||||
RegisterServerEvent('esx_atm:withdraw')
|
||||
AddEventHandler('esx_atm:withdraw', function(amount)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
amount = tonumber(amount)
|
||||
local accountMoney = xPlayer.getAccount('bank').money
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Banker job'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ function CalculateBankSavings(d, h, m)
|
||||
local newMoney = result[i].money + interests
|
||||
bankInterests = bankInterests + interests
|
||||
|
||||
local scope = function(newMoney, owner)
|
||||
local function scope(newMoney, owner)
|
||||
table.insert(asyncTasks, function(cb)
|
||||
MySQL.update('UPDATE addon_account_data SET money = @money WHERE owner = @owner AND account_name = @account_name', {
|
||||
['@money'] = newMoney,
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Barber Shop'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
RegisterServerEvent('esx_barbershop:pay')
|
||||
AddEventHandler('esx_barbershop:pay', function()
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeMoney(Config.Price)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_paid', ESX.Math.GroupDigits(Config.Price)))
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Basic Needs'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Billing'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Boat'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ end)
|
||||
-- Enter / Exit marker events & draw markers
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
local playerCoords, isInMarker, currentZone, letSleep = GetEntityCoords(PlayerPedId()), false, nil, true
|
||||
|
||||
for k,v in pairs(Config.Shops) do
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Clothes Shop'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'CruiseControl System for ESX'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
dependencies {
|
||||
'es_extended'
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Data Store'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
server_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
@@ -17,16 +17,16 @@ function CreateDataStore(name, owner, data)
|
||||
|
||||
self.name = name
|
||||
self.owner = owner
|
||||
self.data = data
|
||||
self.data = type(data) == 'string' and json.decode(data) or data
|
||||
|
||||
local timeoutCallbacks = {}
|
||||
|
||||
self.set = function(key, val)
|
||||
function self.set(key, val)
|
||||
data[key] = val
|
||||
self.save()
|
||||
end
|
||||
|
||||
self.get = function(key, i)
|
||||
function self.get(key, i)
|
||||
local path = stringsplit(key, '.')
|
||||
local obj = self.data
|
||||
|
||||
@@ -41,7 +41,7 @@ function CreateDataStore(name, owner, data)
|
||||
end
|
||||
end
|
||||
|
||||
self.count = function(key, i)
|
||||
function self.count(key, i)
|
||||
local path = stringsplit(key, '.')
|
||||
local obj = self.data
|
||||
|
||||
@@ -60,7 +60,7 @@ function CreateDataStore(name, owner, data)
|
||||
end
|
||||
end
|
||||
|
||||
self.save = function()
|
||||
function self.save()
|
||||
for i=1, #timeoutCallbacks, 1 do
|
||||
ESX.ClearTimeout(timeoutCallbacks[i])
|
||||
timeoutCallbacks[i] = nil
|
||||
|
||||
@@ -12,10 +12,10 @@ AddEventHandler('onResourceStart', function(resourceName)
|
||||
DataStoresIndex[#DataStoresIndex + 1] = data.name
|
||||
DataStores[data.name] = {}
|
||||
end
|
||||
DataStores[data.name][#DataStores[data.name] + 1] = CreateDataStore(data.name, data.owner, data.data)
|
||||
DataStores[data.name][#DataStores[data.name] + 1] = CreateDataStore(data.name, data.owner, json.decode(data.data))
|
||||
else
|
||||
if data.data then
|
||||
SharedDataStores[data.name] = CreateDataStore(data.name, nil, data.data)
|
||||
SharedDataStores[data.name] = CreateDataStore(data.name, nil, json.decode(data.data))
|
||||
else
|
||||
newData[#newData + 1] = {data.name, '\'{}\''}
|
||||
end
|
||||
@@ -26,7 +26,7 @@ AddEventHandler('onResourceStart', function(resourceName)
|
||||
MySQL.prepare('INSERT INTO datastore_data (name, data) VALUES (?, ?)', newData)
|
||||
for i = 1, #newData do
|
||||
local new = newData[i]
|
||||
SharedDataStores[new[1]] = CreateDataStore(new[1], nil, new[2])
|
||||
SharedDataStores[new[1]] = CreateDataStore(new[1], nil, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,8 +51,7 @@ function StopTheoryTest(success)
|
||||
end
|
||||
|
||||
function StartDriveTest(type)
|
||||
local pos = vector3(VehicleSpawnPoint.Pos.x, VehicleSpawnPoint.Pos.y,VehicleSpawnPoint.Pos.z)
|
||||
ESX.Game.SpawnVehicle(Config.VehicleModels[type], pos, Config.Zones.VehicleSpawnPoint.Pos.h, function(vehicle)
|
||||
ESX.Game.SpawnVehicle(Config.VehicleModels[type], vector3(Config.Zones.VehicleSpawnPoint.Pos.x, Config.Zones.VehicleSpawnPoint.Pos.y, Config.Zones.VehicleSpawnPoint.Pos.z), Config.Zones.VehicleSpawnPoint.Pos.h, function(vehicle)
|
||||
CurrentTest = 'drive'
|
||||
CurrentTestType = type
|
||||
CurrentCheckPoint = 0
|
||||
@@ -209,7 +208,7 @@ CreateThread(function()
|
||||
SetBlipAsShortRange(blip, true)
|
||||
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString(_U('driving_school_blip'))
|
||||
AddTextComponentSubstringPlayerName(_U('driving_school_blip'))
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end)
|
||||
|
||||
@@ -263,7 +262,7 @@ end)
|
||||
-- Block UI
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
|
||||
if CurrentTest == 'theory' then
|
||||
local playerPed = PlayerPedId()
|
||||
@@ -360,7 +359,7 @@ end)
|
||||
-- Speed / Damage control
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
|
||||
if CurrentTest == 'drive' then
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX DMV School'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ end)
|
||||
|
||||
RegisterNetEvent('esx_dmvschool:addLicense')
|
||||
AddEventHandler('esx_dmvschool:addLicense', function(type)
|
||||
local _source = source
|
||||
local source = source
|
||||
|
||||
TriggerEvent('esx_license:addLicense', _source, type, function()
|
||||
TriggerEvent('esx_license:getLicenses', _source, function(licenses)
|
||||
TriggerClientEvent('esx_dmvschool:loadLicenses', _source, licenses)
|
||||
TriggerEvent('esx_license:addLicense', source, type, function()
|
||||
TriggerEvent('esx_license:getLicenses', source, function(licenses)
|
||||
TriggerClientEvent('esx_dmvschool:loadLicenses', source, licenses)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -7,7 +7,7 @@ CreateThread(function()
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if #(coords - Config.CircleZones.DrugDealer.coords) < 0.5 then
|
||||
if #(coords - Config.CircleZones.DrugDealer.coords) < 2.0 then
|
||||
if not menuOpen then
|
||||
ESX.ShowHelpNotification(_U('dealer_prompt'))
|
||||
|
||||
@@ -131,7 +131,7 @@ function CreateBlipCircle(coords, text, radius, color, sprite)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString(text)
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ end
|
||||
|
||||
function GenerateWeedCoords()
|
||||
while true do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
|
||||
local weedCoordX, weedCoordY
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Drugs'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -81,15 +81,15 @@ end)
|
||||
RegisterServerEvent('esx_drugs:processCannabis')
|
||||
AddEventHandler('esx_drugs:processCannabis', function()
|
||||
if not playersProcessingCannabis[source] then
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local xCannabis = xPlayer.getInventoryItem('cannabis')
|
||||
local can = true
|
||||
outofbound = false
|
||||
if xCannabis.count >= 3 then
|
||||
while outofbound == false and can do
|
||||
if playersProcessingCannabis[_source] == nil then
|
||||
playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing , function()
|
||||
if playersProcessingCannabis[source] == nil then
|
||||
playersProcessingCannabis[source] = ESX.SetTimeout(Config.Delays.WeedProcessing , function()
|
||||
if xCannabis.count >= 3 then
|
||||
if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then
|
||||
xPlayer.removeInventoryItem('cannabis', 3)
|
||||
@@ -106,7 +106,7 @@ AddEventHandler('esx_drugs:processCannabis', function()
|
||||
TriggerEvent('esx_drugs:cancelProcessing')
|
||||
end
|
||||
|
||||
playersProcessingCannabis[_source] = nil
|
||||
playersProcessingCannabis[source] = nil
|
||||
end)
|
||||
else
|
||||
Wait(Config.Delays.WeedProcessing)
|
||||
|
||||
@@ -59,7 +59,7 @@ AddEventHandler('esx_garage:hasEnteredMarker', function(name, part, parking)
|
||||
for j=1, #vehicles, 1 do
|
||||
|
||||
if i == vehicles[j].zone then
|
||||
local spawn = function(j)
|
||||
local function spawn(j)
|
||||
|
||||
local vehicle = GetClosestVehicle(garage.Parkings[i].Pos.x, garage.Parkings[i].Pos.y, garage.Parkings[i].Pos.z, 2.0, 0, 71)
|
||||
|
||||
@@ -97,7 +97,7 @@ AddEventHandler('esx_garage:hasEnteredMarker', function(name, part, parking)
|
||||
for j=1, #vehicles, 1 do
|
||||
|
||||
if i == vehicles[j].zone then
|
||||
local spawn = function(j)
|
||||
local function spawn(j)
|
||||
|
||||
local vehicle = GetClosestVehicle(garage.Parkings[i].Pos.x, garage.Parkings[i].Pos.garage.Parkings[i].Pos.y, garage.Parkings[i].Pos.z, 2.0, 0, 71)
|
||||
|
||||
@@ -138,7 +138,7 @@ AddEventHandler('esx_garage:hasEnteredMarker', function(name, part, parking)
|
||||
for j=1, #vehicles, 1 do
|
||||
|
||||
if i == vehicles[j].zone then
|
||||
local spawn = function(j)
|
||||
local function spawn(j)
|
||||
|
||||
local vehicle = GetClosestVehicle(garage.Parkings[i].Pos.x, garage.Parkings[i].Pos.y, garage.Parkings[i].Pos.z, 2.0, 0, 71)
|
||||
|
||||
@@ -273,7 +273,7 @@ CreateThread(function()
|
||||
SetBlipAsShortRange(blip, true)
|
||||
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString("Garage")
|
||||
AddTextComponentSubstringPlayerName("Garage")
|
||||
EndTextCommandSetBlipName(blip)
|
||||
|
||||
end
|
||||
@@ -390,7 +390,7 @@ CreateThread(function()
|
||||
|
||||
TriggerEvent('esx_property:hasExitedMarker', LastGarage, LastPart, LastParking)
|
||||
end
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
else Wait(500) end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Garage'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
RegisterServerEvent('esx_garage:setParking')
|
||||
AddEventHandler('esx_garage:setParking', function(garage, zone, vehicleProps)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if vehicleProps == false then
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ AddEventHandler('esx_holdup:startTimer', function()
|
||||
end)
|
||||
CreateThread(function()
|
||||
while holdingUp do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
DrawTxt(0.66, 1.44, 1.0, 1.0, 0.4, _U('robbery_timer', timer), 255, 255, 255, 255)
|
||||
end
|
||||
end)
|
||||
@@ -73,14 +73,14 @@ CreateThread(function()
|
||||
SetBlipScale(blip, 0.8)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
BeginTextCommandSetBlipName('STRING')
|
||||
AddTextComponentString(_U('shop_robbery'))
|
||||
AddTextComponentSubstringPlayerName(_U('shop_robbery'))
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
local playerPos, letSleep = GetEntityCoords(PlayerPedId()), true
|
||||
for k,v in pairs(Stores) do
|
||||
local distance = #(playerPos - v.position)
|
||||
@@ -88,7 +88,7 @@ CreateThread(function()
|
||||
if not holdingUp then
|
||||
letSleep = false
|
||||
DrawMarker(Config.Marker.Type, v.position, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, false, false, false, false)
|
||||
if distance < 0.5 then
|
||||
if distance < 2.0 then
|
||||
ESX.ShowHelpNotification(_U('press_to_rob', v.nameOfStore))
|
||||
if IsControlJustReleased(0, 38) then
|
||||
if IsPedArmed(PlayerPedId(), 4) then
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Holdup'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -3,28 +3,28 @@ local robbers = {}
|
||||
|
||||
RegisterServerEvent('esx_holdup:tooFar')
|
||||
AddEventHandler('esx_holdup:tooFar', function(currentStore)
|
||||
local _source = source
|
||||
local source = source
|
||||
rob = false
|
||||
for _, xPlayer in pairs(ESX.GetExtendedPlayers('job', 'police')) do
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('robbery_cancelled_at', Stores[currentStore].nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:killBlip', xPlayer.source)
|
||||
end
|
||||
if robbers[_source] then
|
||||
TriggerClientEvent('esx_holdup:tooFar', _source)
|
||||
ESX.ClearTimeout(robbers[_source])
|
||||
robbers[_source] = nil
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('robbery_cancelled_at', Stores[currentStore].nameOfStore))
|
||||
if robbers[source] then
|
||||
TriggerClientEvent('esx_holdup:tooFar', source)
|
||||
ESX.ClearTimeout(robbers[source])
|
||||
robbers[source] = nil
|
||||
TriggerClientEvent('esx:showNotification', source, _U('robbery_cancelled_at', Stores[currentStore].nameOfStore))
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_holdup:robberyStarted')
|
||||
AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
if Stores[currentStore] then
|
||||
local store = Stores[currentStore]
|
||||
if (os.time() - store.lastRobbed) < Config.TimerBeforeNewRob and store.lastRobbed ~= 0 then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('recently_robbed', Config.TimerBeforeNewRob - (os.time() - store.lastRobbed)))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('recently_robbed', Config.TimerBeforeNewRob - (os.time() - store.lastRobbed)))
|
||||
return
|
||||
end
|
||||
if not rob then
|
||||
@@ -35,15 +35,15 @@ AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rob_in_prog', store.nameOfStore))
|
||||
TriggerClientEvent('esx_holdup:setBlip', xPlayer.source, Stores[currentStore].position)
|
||||
end
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('started_to_rob', store.nameOfStore))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('alarm_triggered'))
|
||||
TriggerClientEvent('esx_holdup:currentlyRobbing', _source, currentStore)
|
||||
TriggerClientEvent('esx_holdup:startTimer', _source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('started_to_rob', store.nameOfStore))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('alarm_triggered'))
|
||||
TriggerClientEvent('esx_holdup:currentlyRobbing', source, currentStore)
|
||||
TriggerClientEvent('esx_holdup:startTimer', source)
|
||||
Stores[currentStore].lastRobbed = os.time()
|
||||
robbers[_source] = ESX.SetTimeout(store.secondsRemaining * 1000, function()
|
||||
robbers[source] = ESX.SetTimeout(store.secondsRemaining * 1000, function()
|
||||
rob = false
|
||||
if xPlayer then
|
||||
TriggerClientEvent('esx_holdup:robberyComplete', _source, store.reward)
|
||||
TriggerClientEvent('esx_holdup:robberyComplete', source, store.reward)
|
||||
if Config.GiveBlackMoney then
|
||||
xPlayer.addAccountMoney('black_money', store.reward)
|
||||
else
|
||||
@@ -57,10 +57,10 @@ AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
end
|
||||
end)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('min_police', Config.PoliceNumberRequired))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('min_police', Config.PoliceNumberRequired))
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('robbery_already'))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('robbery_already'))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -33,7 +33,7 @@ end)
|
||||
-- Activate menu when player is inside marker, and draw markers
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
isInMarker = false
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Job Listing'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ function refreshBlips()
|
||||
SetBlipAsShortRange(blip, true)
|
||||
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString(zoneValues.Name)
|
||||
AddTextComponentSubstringPlayerName(zoneValues.Name)
|
||||
EndTextCommandSetBlipName(blip)
|
||||
table.insert(JobBlips, blip)
|
||||
end
|
||||
@@ -302,7 +302,7 @@ end)
|
||||
-- Show top left hint
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
|
||||
if hintIsShowed then
|
||||
ESX.ShowHelpNotification(hintToDisplay)
|
||||
@@ -315,7 +315,7 @@ end)
|
||||
-- Display markers (only if on duty and the player's job ones)
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
local zones = {}
|
||||
|
||||
if ESX.PlayerData.job ~= nil then
|
||||
@@ -401,7 +401,7 @@ end)
|
||||
CreateThread(function()
|
||||
while true do
|
||||
|
||||
Wait(1)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name ~= 'unemployed' then
|
||||
local zones = nil
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Jobs'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ Config.Jobs.lumberjack = {
|
||||
Color = {r = 204, g = 204, b = 0},
|
||||
Marker = 1,
|
||||
Blip = false,
|
||||
Name = _U('lj_cutwood'),
|
||||
Name = _U('lj_woodcutting'),
|
||||
Type = 'work',
|
||||
Item = {
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['br'] = {
|
||||
['lj_mapblip'] = 'pilha de madeira',
|
||||
['lj_wood'] = 'madeira',
|
||||
['lj_pickup'] = 'pressione ~INPUT_PICKUP~ para recuperar madeira.',
|
||||
['lj_cutwood'] = 'corte de Madeira',
|
||||
['lj_woodcutting'] = 'corte de Madeira',
|
||||
['lj_cutwood_button'] = 'pressione ~INPUT_PICKUP~ para cortar madeira.',
|
||||
['lj_board'] = 'tábua',
|
||||
['lj_planks'] = 'tábua embalada',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['cs'] = {
|
||||
['lj_mapblip'] = 'vyroba dreva',
|
||||
['lj_wood'] = 'drevo',
|
||||
['lj_pickup'] = 'stiskni ~INPUT_PICKUP~ pro ziskani dreva.',
|
||||
['lj_cutwood'] = 'rezani dreva',
|
||||
['lj_woodcutting'] = 'rezani dreva',
|
||||
['lj_cutwood_button'] = 'stiskni ~INPUT_PICKUP~ pro rezani dreva.',
|
||||
['lj_board'] = 'prkna',
|
||||
['lj_planks'] = 'baleni prken',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['de'] = {
|
||||
['lj_mapblip'] = 'Holzstapel',
|
||||
['lj_wood'] = 'Holz',
|
||||
['lj_pickup'] = 'Drücke ~INPUT_PICKUP~ um Holz zu sammeln.',
|
||||
['lj_cutwood'] = 'Holzverarbeitung',
|
||||
['lj_woodcutting'] = 'Holzverarbeitung',
|
||||
['lj_cutwood_button'] = 'Drücke ~INPUT_PICKUP~ um das Holz zu schneiden.',
|
||||
['lj_board'] = 'Bretter',
|
||||
['lj_planks'] = 'Holz verarbeiten',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['en'] = {
|
||||
['lj_mapblip'] = 'wood pile',
|
||||
['lj_wood'] = 'wood',
|
||||
['lj_pickup'] = 'press ~INPUT_PICKUP~ to retrieve wood.',
|
||||
['lj_cutwood'] = 'wood cutting',
|
||||
['lj_woodcutting'] = 'wood cutting',
|
||||
['lj_cutwood_button'] = 'press ~INPUT_PICKUP~ to cut wood.',
|
||||
['lj_board'] = 'boards',
|
||||
['lj_planks'] = 'package board',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['es'] = {
|
||||
['lj_mapblip'] = 'pila de madera',
|
||||
['lj_wood'] = 'madera',
|
||||
['lj_pickup'] = 'presiona ~INPUT_PICKUP~ para agarrar madera.',
|
||||
['lj_cutwood'] = 'cortar madera',
|
||||
['lj_woodcutting'] = 'cortar madera',
|
||||
['lj_cutwood_button'] = 'presiona ~INPUT_PICKUP~ para cortar madera.',
|
||||
['lj_board'] = 'tablas',
|
||||
['lj_planks'] = 'empaquetar',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['fi'] = {
|
||||
['lj_mapblip'] = 'puukasa',
|
||||
['lj_wood'] = 'puu',
|
||||
['lj_pickup'] = 'paina ~INPUT_PICKUP~ kerätäksesi puita',
|
||||
['lj_cutwood'] = 'puun hakkuu',
|
||||
['lj_woodcutting'] = 'puun hakkuu',
|
||||
['lj_cutwood_button'] = 'paina ~INPUT_PICKUP~ pilkkoaksesi puita.',
|
||||
['lj_board'] = 'lankkuja',
|
||||
['lj_planks'] = 'paketoituja lankkuja',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['fr'] = {
|
||||
['lj_mapblip'] = 'tas de bois',
|
||||
['lj_wood'] = 'bois',
|
||||
['lj_pickup'] = 'appuyez sur ~INPUT_PICKUP~ pour récupérer du bois.',
|
||||
['lj_cutwood'] = 'découpe du bois',
|
||||
['lj_woodcutting'] = 'découpe du bois',
|
||||
['lj_cutwood_button'] = 'appuyez sur ~INPUT_PICKUP~ pour couper du bois.',
|
||||
['lj_board'] = 'planches',
|
||||
['lj_planks'] = 'paquet de planche',
|
||||
|
||||
@@ -31,7 +31,7 @@ Locales['sv'] = {
|
||||
['lj_mapblip'] = 'trähög',
|
||||
['lj_wood'] = 'träd',
|
||||
['lj_pickup'] = 'tryck ~INPUT_PICKUP~ för att hämta trä.',
|
||||
['lj_cutwood'] = 'trädfällning',
|
||||
['lj_woodcutting'] = 'trädfällning',
|
||||
['lj_cutwood_button'] = 'tryck ~INPUT_PICKUP~ för att hugga trä.',
|
||||
['lj_board'] = 'brädor',
|
||||
['lj_planks'] = 'brädpaket',
|
||||
|
||||
@@ -6,7 +6,7 @@ CreateThread(function()
|
||||
local timeNow = os.clock()
|
||||
|
||||
for playerId,data in pairs(playersWorking) do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
-- is player still online?
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX License'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
server_scripts {
|
||||
'@async/async.lua',
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX LS Customs'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ local Vehicles
|
||||
|
||||
RegisterServerEvent('esx_lscustom:buyMod')
|
||||
AddEventHandler('esx_lscustom:buyMod', function(price)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
price = tonumber(price)
|
||||
|
||||
if Config.IsMechanicJobOnly then
|
||||
@@ -14,21 +14,21 @@ AddEventHandler('esx_lscustom:buyMod', function(price)
|
||||
end)
|
||||
|
||||
if price < societyAccount.money then
|
||||
TriggerClientEvent('esx_lscustom:installMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
|
||||
TriggerClientEvent('esx_lscustom:installMod', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('purchased'))
|
||||
societyAccount.removeMoney(price)
|
||||
else
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_money'))
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_money'))
|
||||
end
|
||||
else
|
||||
if price < xPlayer.getMoney() then
|
||||
TriggerClientEvent('esx_lscustom:installMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
|
||||
TriggerClientEvent('esx_lscustom:installMod', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('purchased'))
|
||||
xPlayer.removeMoney(price)
|
||||
else
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_money'))
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_money'))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -767,7 +767,7 @@ end)
|
||||
-- Pop NPC mission vehicle when inside area
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
|
||||
if NPCTargetTowableZone and not NPCHasSpawnedTowable then
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
@@ -838,7 +838,7 @@ end)
|
||||
-- Enter / Exit marker events
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10)
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
|
||||
@@ -935,11 +935,12 @@ CreateThread(function()
|
||||
TriggerServerEvent('esx_society:putVehicleInGarage', 'mechanic', vehicleProps)
|
||||
|
||||
else
|
||||
local entityModel = GetEntityModel(CurrentActionData.vehicle)
|
||||
|
||||
if
|
||||
GetEntityModel(vehicle) == GetHashKey("flatbed") or
|
||||
GetEntityModel(vehicle) == GetHashKey("towtruck2") or
|
||||
GetEntityModel(vehicle) == GetHashKey("slamvan3")
|
||||
entityModel == GetHashKey("flatbed") or
|
||||
entityModel == GetHashKey("towtruck2") or
|
||||
entityModel == GetHashKey("slamvan3")
|
||||
then
|
||||
TriggerServerEvent('esx_service:disableService', 'mechanic')
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Mechanic Job'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ end
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:startHarvest')
|
||||
AddEventHandler('esx_mechanicjob:startHarvest', function()
|
||||
local _source = source
|
||||
PlayersHarvesting[_source] = true
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can'))
|
||||
local source = source
|
||||
PlayersHarvesting[source] = true
|
||||
TriggerClientEvent('esx:showNotification', source, _U('recovery_gas_can'))
|
||||
Harvest(source)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:stopHarvest')
|
||||
AddEventHandler('esx_mechanicjob:stopHarvest', function()
|
||||
local _source = source
|
||||
PlayersHarvesting[_source] = false
|
||||
local source = source
|
||||
PlayersHarvesting[source] = false
|
||||
end)
|
||||
|
||||
local function Harvest2(source)
|
||||
@@ -59,16 +59,16 @@ end
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:startHarvest2')
|
||||
AddEventHandler('esx_mechanicjob:startHarvest2', function()
|
||||
local _source = source
|
||||
PlayersHarvesting2[_source] = true
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools'))
|
||||
Harvest2(_source)
|
||||
local source = source
|
||||
PlayersHarvesting2[source] = true
|
||||
TriggerClientEvent('esx:showNotification', source, _U('recovery_repair_tools'))
|
||||
Harvest2(source)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:stopHarvest2')
|
||||
AddEventHandler('esx_mechanicjob:stopHarvest2', function()
|
||||
local _source = source
|
||||
PlayersHarvesting2[_source] = false
|
||||
local source = source
|
||||
PlayersHarvesting2[source] = false
|
||||
end)
|
||||
|
||||
local function Harvest3(source)
|
||||
@@ -90,16 +90,16 @@ end
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:startHarvest3')
|
||||
AddEventHandler('esx_mechanicjob:startHarvest3', function()
|
||||
local _source = source
|
||||
PlayersHarvesting3[_source] = true
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools'))
|
||||
Harvest3(_source)
|
||||
local source = source
|
||||
PlayersHarvesting3[source] = true
|
||||
TriggerClientEvent('esx:showNotification', source, _U('recovery_body_tools'))
|
||||
Harvest3(source)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:stopHarvest3')
|
||||
AddEventHandler('esx_mechanicjob:stopHarvest3', function()
|
||||
local _source = source
|
||||
PlayersHarvesting3[_source] = false
|
||||
local source = source
|
||||
PlayersHarvesting3[source] = false
|
||||
end)
|
||||
|
||||
local function Craft(source)
|
||||
@@ -123,16 +123,16 @@ end
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:startCraft')
|
||||
AddEventHandler('esx_mechanicjob:startCraft', function()
|
||||
local _source = source
|
||||
PlayersCrafting[_source] = true
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch'))
|
||||
Craft(_source)
|
||||
local source = source
|
||||
PlayersCrafting[source] = true
|
||||
TriggerClientEvent('esx:showNotification', source, _U('assembling_blowtorch'))
|
||||
Craft(source)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:stopCraft')
|
||||
AddEventHandler('esx_mechanicjob:stopCraft', function()
|
||||
local _source = source
|
||||
PlayersCrafting[_source] = false
|
||||
local source = source
|
||||
PlayersCrafting[source] = false
|
||||
end)
|
||||
|
||||
local function Craft2(source)
|
||||
@@ -156,16 +156,16 @@ end
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:startCraft2')
|
||||
AddEventHandler('esx_mechanicjob:startCraft2', function()
|
||||
local _source = source
|
||||
PlayersCrafting2[_source] = true
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit'))
|
||||
Craft2(_source)
|
||||
local source = source
|
||||
PlayersCrafting2[source] = true
|
||||
TriggerClientEvent('esx:showNotification', source, _U('assembling_repair_kit'))
|
||||
Craft2(source)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:stopCraft2')
|
||||
AddEventHandler('esx_mechanicjob:stopCraft2', function()
|
||||
local _source = source
|
||||
PlayersCrafting2[_source] = false
|
||||
local source = source
|
||||
PlayersCrafting2[source] = false
|
||||
end)
|
||||
|
||||
local function Craft3(source)
|
||||
@@ -189,22 +189,22 @@ end
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:startCraft3')
|
||||
AddEventHandler('esx_mechanicjob:startCraft3', function()
|
||||
local _source = source
|
||||
PlayersCrafting3[_source] = true
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit'))
|
||||
Craft3(_source)
|
||||
local source = source
|
||||
PlayersCrafting3[source] = true
|
||||
TriggerClientEvent('esx:showNotification', source, _U('assembling_body_kit'))
|
||||
Craft3(source)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:stopCraft3')
|
||||
AddEventHandler('esx_mechanicjob:stopCraft3', function()
|
||||
local _source = source
|
||||
PlayersCrafting3[_source] = false
|
||||
local source = source
|
||||
PlayersCrafting3[source] = false
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:onNPCJobMissionCompleted')
|
||||
AddEventHandler('esx_mechanicjob:onNPCJobMissionCompleted', function()
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max);
|
||||
|
||||
if xPlayer.job.grade >= 3 then
|
||||
@@ -215,37 +215,37 @@ AddEventHandler('esx_mechanicjob:onNPCJobMissionCompleted', function()
|
||||
account.addMoney(total)
|
||||
end)
|
||||
|
||||
TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total)
|
||||
TriggerClientEvent("esx:showNotification", source, _U('your_comp_earned').. total)
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('blowpipe', function(source)
|
||||
local _source = source
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('blowpipe', 1)
|
||||
|
||||
TriggerClientEvent('esx_mechanicjob:onHijack', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch'))
|
||||
TriggerClientEvent('esx_mechanicjob:onHijack', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_used_blowtorch'))
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('fixkit', function(source)
|
||||
local _source = source
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('fixkit', 1)
|
||||
|
||||
TriggerClientEvent('esx_mechanicjob:onFixkit', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit'))
|
||||
TriggerClientEvent('esx_mechanicjob:onFixkit', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_used_repair_kit'))
|
||||
end)
|
||||
|
||||
ESX.RegisterUsableItem('carokit', function(source)
|
||||
local _source = source
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeInventoryItem('carokit', 1)
|
||||
|
||||
TriggerClientEvent('esx_mechanicjob:onCarokit', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit'))
|
||||
TriggerClientEvent('esx_mechanicjob:onCarokit', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_used_body_kit'))
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_mechanicjob:getStockItem')
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Optional Needs'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts)
|
||||
PhoneData.contacts = {}
|
||||
|
||||
for i=1, #contacts, 1 do
|
||||
contacts[i].online = (PhoneNumberSources[contacts[i].number] == nil and false or NetworkIsPlayerActive(GetPlayerFromServerId(PhoneNumberSources[contacts[i].number]))),
|
||||
contacts[i].online = (PhoneNumberSources[contacts[i].number] == nil and false or NetworkIsPlayerActive(GetPlayerFromServerId(PhoneNumberSources[contacts[i].number])))
|
||||
table.insert(PhoneData.contacts, contacts[i])
|
||||
end
|
||||
|
||||
@@ -241,7 +241,7 @@ CreateThread(function()
|
||||
else
|
||||
-- open phone
|
||||
-- todo: is player busy (handcuffed, etc)
|
||||
if IsControlJustReleased(0, 288) and IsInputDisabled(0) then
|
||||
if IsControlJustReleased(0, 288) and IsUsingKeyboard(0) then
|
||||
if not ESX.UI.Menu.IsOpen('phone', GetCurrentResourceName(), 'main') then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.UI.Menu.Open('phone', GetCurrentResourceName(), 'main')
|
||||
@@ -267,7 +267,7 @@ CreateThread(function()
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, 38) and IsInputDisabled(0) then
|
||||
if IsControlJustReleased(0, 38) and IsUsingKeyboard(0) then
|
||||
if CurrentAction == 'dispatch' then
|
||||
TriggerServerEvent('esx_phone:stopDispatch', CurrentDispatchRequestId)
|
||||
SetNewWaypoint(CurrentActionData.position.x, CurrentActionData.position.y)
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Phone'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ function OpenCloakroomMenu()
|
||||
end, 'police')
|
||||
|
||||
while awaitService == nil do
|
||||
Wait(5)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
-- if we couldn't enter service don't let the player get changed
|
||||
|
||||
@@ -144,10 +144,15 @@ function StoreNearbyVehicle(playerCoords)
|
||||
local isBusy = true
|
||||
|
||||
CreateThread(function()
|
||||
BeginTextCommandBusyspinnerOn('STRING')
|
||||
AddTextComponentSubstringPlayerName(_U('garage_storing'))
|
||||
EndTextCommandBusyspinnerOn(4)
|
||||
|
||||
while isBusy do
|
||||
Wait(0)
|
||||
drawLoadingText(_U('garage_storing'), 255, 255, 255, 255)
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
BusyspinnerOff()
|
||||
end)
|
||||
|
||||
-- Workaround for vehicle not deleting when other players are near it.
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Police Job'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ TriggerEvent('esx_society:registerSociety', 'police', 'Police', 'society_police'
|
||||
|
||||
RegisterNetEvent('esx_policejob:confiscatePlayerItem')
|
||||
AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType, itemName, amount)
|
||||
local _source = source
|
||||
local sourceXPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local sourceXPlayer = ESX.GetPlayerFromId(source)
|
||||
local targetXPlayer = ESX.GetPlayerFromId(target)
|
||||
|
||||
if sourceXPlayer.job.name ~= 'police' then
|
||||
@@ -114,8 +114,8 @@ end)
|
||||
|
||||
RegisterNetEvent('esx_policejob:getStockItem')
|
||||
AddEventHandler('esx_policejob:getStockItem', function(itemName, count)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_police', function(inventory)
|
||||
local inventoryItem = inventory.getItem(itemName)
|
||||
@@ -422,6 +422,7 @@ AddEventHandler('playerDropped', function()
|
||||
local playerId = source
|
||||
if playerId then
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
if xPlayer and xPlayer.job.name == 'police' then
|
||||
Wait(5000)
|
||||
TriggerClientEvent('esx_policejob:updateBlip', -1)
|
||||
@@ -431,7 +432,9 @@ end)
|
||||
|
||||
RegisterNetEvent('esx_policejob:spawned')
|
||||
AddEventHandler('esx_policejob:spawned', function()
|
||||
local playerId = source
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
|
||||
if xPlayer and xPlayer.job.name == 'police' then
|
||||
Wait(5000)
|
||||
TriggerClientEvent('esx_policejob:updateBlip', -1)
|
||||
@@ -441,7 +444,7 @@ end)
|
||||
RegisterNetEvent('esx_policejob:forceBlip')
|
||||
AddEventHandler('esx_policejob:forceBlip', function()
|
||||
for _, xPlayer in pairs(ESX.GetExtendedPlayers('job', 'police')) do
|
||||
TriggerClientEvent('esx_policejob:updateBlip', -1)
|
||||
TriggerClientEvent('esx_policejob:updateBlip', xPlayer.source)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ end
|
||||
|
||||
function OpenGatewayMenu(property)
|
||||
if Config.EnablePlayerManagement then
|
||||
OpenGatewayOwnedPropertiesMenu(gatewayProperties)
|
||||
OpenGatewayOwnedPropertiesMenu(property)
|
||||
else
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'gateway', {
|
||||
title = property.name,
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Property'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ ESX.RegisterServerCallback('esx_property:getProperties', function(source, cb)
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_ownedproperty:getOwnedProperties', function(cb)
|
||||
MySQL.query('SELECT * FROM owned_properties', {}, function(result)
|
||||
MySQL.query('SELECT * FROM owned_properties', function(result)
|
||||
local properties = {}
|
||||
|
||||
for i=1, #result, 1 do
|
||||
@@ -410,7 +410,7 @@ function payRent(d, h, m)
|
||||
local tasks, timeStart = {}, os.clock()
|
||||
print('[esx_property] [^2INFO^7] Paying rent cron job started')
|
||||
|
||||
MySQL.query('SELECT * FROM owned_properties WHERE rented = 1', {}, function(result)
|
||||
MySQL.query('SELECT * FROM owned_properties WHERE rented = 1', function(result)
|
||||
for k,v in ipairs(result) do
|
||||
table.insert(tasks, function(cb)
|
||||
local xPlayer = ESX.GetPlayerFromIdentifier(v.owner)
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Real Estate Job'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX RP Chat'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ game 'gta5'
|
||||
|
||||
description 'ESX Service'
|
||||
|
||||
version 'legacy'
|
||||
version '1.5.0'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ end)
|
||||
|
||||
AddEventHandler('esx:playerDropped', function(playerId, reason)
|
||||
for k,v in pairs(InService) do
|
||||
if v[_source] == true then
|
||||
v[_source] = nil
|
||||
if v[source] == true then
|
||||
v[source] = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user