refactor: update native references

Many natives have updated / more accurate names.
This commit is contained in:
Linden
2022-02-14 13:42:43 +11:00
parent f81683751d
commit b72e1e0b04
34 changed files with 195 additions and 186 deletions
+12 -12
View File
@@ -52,16 +52,16 @@ ESX.SetPlayerData = function(key, val)
end
ESX.ShowNotification = function(msg)
SetNotificationTextEntry('STRING')
AddTextComponentString(msg)
DrawNotification(0,1)
BeginTextCommandThefeedPost('STRING')
AddTextComponentSubstringPlayerName(msg)
EndTextCommandThefeedPostTicker(0,1)
end
ESX.ShowAdvancedNotification = function(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
@@ -511,7 +511,7 @@ ESX.Game.GetVehicleInDirection = function()
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
@@ -555,7 +555,7 @@ ESX.Game.GetVehicleProperties = function(vehicle)
wheels = GetVehicleWheelType(vehicle),
windowTint = GetVehicleWindowTint(vehicle),
xenonColor = GetVehicleXenonLightsColour(vehicle),
xenonColor = GetVehicleXenonLightsColor(vehicle),
neonEnabled = {
IsVehicleNeonLightEnabled(vehicle, 0),
@@ -661,7 +661,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 +715,10 @@ ESX.Game.SetVehicleProperties = function(vehicle, props)
end
end
ESX.Game.Utils.DrawText3D = function(coords, text, size, font)
ESX.Game.Utils.EndTextCommandDisplayText3D = function(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,11 +732,11 @@ 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
+1 -1
View File
@@ -480,7 +480,7 @@ CreateThread(function()
label = ('%s~n~%s'):format(label, _U('threw_pickup_prompt'))
end
ESX.Game.Utils.DrawText3D({
ESX.Game.Utils.EndTextCommandDisplayText3D({
x = pickup.coords.x,
y = pickup.coords.y,
z = pickup.coords.z + 0.25
+14 -14
View File
@@ -2,8 +2,8 @@ ESX.Scaleform.ShowFreemodeMessage = function(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
@@ -20,20 +20,20 @@ ESX.Scaleform.ShowBreakingNews = function(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()
@@ -52,11 +52,11 @@ ESX.Scaleform.ShowPopupWarning = function(title, msg, bottom, sec)
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()
+1 -1
View File
@@ -306,7 +306,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
+6 -6
View File
@@ -61,32 +61,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
+13 -13
View File
@@ -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),
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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)
+9 -10
View File
@@ -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
@@ -325,7 +324,7 @@ function RemoveItemsAfterRPDeath()
ESX.SetPlayerData('loadout', {})
RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading)
StopScreenEffect('DeathFailOut')
AnimpostfxStop('DeathFailOut')
DoScreenFadeIn(800)
end)
end)
@@ -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.
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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
+2 -2
View File
@@ -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)))
+1 -1
View File
@@ -209,7 +209,7 @@ CreateThread(function()
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('driving_school_blip'))
AddTextComponentSubstringPlayerName(_U('driving_school_blip'))
EndTextCommandSetBlipName(blip)
end)
+4 -4
View File
@@ -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)
+1 -1
View File
@@ -131,7 +131,7 @@ function CreateBlipCircle(coords, text, radius, color, sprite)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(text)
AddTextComponentSubstringPlayerName(text)
EndTextCommandSetBlipName(blip)
end
+5 -5
View File
@@ -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)
+1 -1
View File
@@ -273,7 +273,7 @@ CreateThread(function()
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Garage")
AddTextComponentSubstringPlayerName("Garage")
EndTextCommandSetBlipName(blip)
end
+2 -2
View File
@@ -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
+1 -1
View File
@@ -73,7 +73,7 @@ CreateThread(function()
SetBlipScale(blip, 0.8)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentString(_U('shop_robbery'))
AddTextComponentSubstringPlayerName(_U('shop_robbery'))
EndTextCommandSetBlipName(blip)
end
end)
+17 -17
View File
@@ -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)
+1 -1
View File
@@ -255,7 +255,7 @@ function refreshBlips()
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(zoneValues.Name)
AddTextComponentSubstringPlayerName(zoneValues.Name)
EndTextCommandSetBlipName(blip)
table.insert(JobBlips, blip)
end
+10 -10
View File
@@ -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)
+47 -47
View File
@@ -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')
+2 -2
View File
@@ -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)
@@ -143,11 +143,16 @@ function StoreNearbyVehicle(playerCoords)
ESX.Game.DeleteVehicle(vehicleId)
local isBusy = true
CreateThread(function()
Citizen.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 -4
View File
@@ -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)
+1 -1
View File
@@ -790,7 +790,7 @@ CreateThread(function()
if distance < Config.DrawDistance then
DrawMarker(Config.MarkerType, property.entering.x, property.entering.y, property.entering.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false)
if Config.MarkerText == true then
ESX.Game.Utils.DrawText3D(property.entering, property.name, 2)
ESX.Game.Utils.EndTextCommandDisplayText3D(property.entering, property.name, 2)
end
letSleep = false
end
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -2,8 +2,8 @@ local ShopItems = {}
RegisterServerEvent('esx_shops:buyItem')
AddEventHandler('esx_shops:buyItem', function(itemName, amount, zone)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
amount = ESX.Math.Round(amount)
+1 -1
View File
@@ -24,7 +24,7 @@ if Config.Debug then
local text = ('ID: %s~n~Hash: %s~n~Model: %s'):format(id, hash, model)
ESX.Game.Utils.DrawText3D({
ESX.Game.Utils.EndTextCommandDisplayText3D({
x = coords.x,
y = coords.y,
z = coords.z + 2.0
+2 -2
View File
@@ -850,8 +850,8 @@ CreateThread(function()
RequestIpl('shr_int') -- Load walls and floor
local interiorID = 7170
LoadInterior(interiorID)
EnableInteriorProp(interiorID, 'csr_beforeMission') -- Load large window
PinInteriorInMemory(interiorID)
ActivateInteriorEntitySet(interiorID, 'csr_beforeMission') -- Load large window
RefreshInterior(interiorID)
end)
+4 -4
View File
@@ -113,8 +113,8 @@ end)
RegisterNetEvent('esx_vehicleshop:getStockItem')
AddEventHandler('esx_vehicleshop: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_cardealer', function(inventory)
local item = inventory.getItem(itemName)
@@ -138,8 +138,8 @@ end)
RegisterNetEvent('esx_vehicleshop:putStockItems')
AddEventHandler('esx_vehicleshop:putStockItems', function(itemName, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function(inventory)
local item = inventory.getItem(itemName)
+5 -5
View File
@@ -90,11 +90,11 @@ function DisplayBoughtScaleform(weaponName, price)
BeginScaleformMovieMethod(scaleform, 'SHOW_WEAPON_PURCHASED')
PushScaleformMovieMethodParameterString(_U('weapon_bought', ESX.Math.GroupDigits(price)))
PushScaleformMovieMethodParameterString(ESX.GetWeaponLabel(weaponName))
PushScaleformMovieMethodParameterInt(GetHashKey(weaponName))
PushScaleformMovieMethodParameterString('')
PushScaleformMovieMethodParameterInt(100)
ScaleformMovieMethodAddParamTextureNameString(_U('weapon_bought', ESX.Math.GroupDigits(price)))
ScaleformMovieMethodAddParamTextureNameString(ESX.GetWeaponLabel(weaponName))
ScaleformMovieMethodAddParamInt(GetHashKey(weaponName))
ScaleformMovieMethodAddParamTextureNameString('')
ScaleformMovieMethodAddParamInt(100)
EndScaleformMovieMethod()