mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
Merge pull request #718 from fivemland/locale-update
refactor/feat(es_extended): small refactor and add missing locales
This commit is contained in:
+151
-168
@@ -512,158 +512,147 @@ AddEventHandler("esx:tpm", function()
|
|||||||
local GetVehiclePedIsIn = GetVehiclePedIsIn
|
local GetVehiclePedIsIn = GetVehiclePedIsIn
|
||||||
|
|
||||||
ESX.TriggerServerCallback("esx:isUserAdmin", function(admin)
|
ESX.TriggerServerCallback("esx:isUserAdmin", function(admin)
|
||||||
if admin then
|
if not admin then
|
||||||
local blipMarker = GetFirstBlipInfoId(8)
|
return
|
||||||
if not DoesBlipExist(blipMarker) then
|
|
||||||
ESX.ShowNotification('No Waypoint Set.', true, false, 140)
|
|
||||||
return 'marker'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Fade screen to hide how clients get teleported.
|
|
||||||
DoScreenFadeOut(650)
|
|
||||||
while not IsScreenFadedOut() do
|
|
||||||
Wait(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
local ped, coords = ESX.PlayerData.ped, GetBlipInfoIdCoord(blipMarker)
|
|
||||||
local vehicle = GetVehiclePedIsIn(ped, false)
|
|
||||||
local oldCoords = GetEntityCoords(ped)
|
|
||||||
|
|
||||||
-- Unpack coords instead of having to unpack them while iterating.
|
|
||||||
-- 825.0 seems to be the max a player can reach while 0.0 being the lowest.
|
|
||||||
local x, y, groundZ, Z_START = coords['x'], coords['y'], 850.0, 950.0
|
|
||||||
local found = false
|
|
||||||
if vehicle > 0 then
|
|
||||||
FreezeEntityPosition(vehicle, true)
|
|
||||||
else
|
|
||||||
FreezeEntityPosition(ped, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = Z_START, 0, -25.0 do
|
|
||||||
local z = i
|
|
||||||
if (i % 2) ~= 0 then
|
|
||||||
z = Z_START - i
|
|
||||||
end
|
|
||||||
|
|
||||||
NewLoadSceneStart(x, y, z, x, y, z, 50.0, 0)
|
|
||||||
local curTime = GetGameTimer()
|
|
||||||
while IsNetworkLoadingScene() do
|
|
||||||
if GetGameTimer() - curTime > 1000 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
Wait(0)
|
|
||||||
end
|
|
||||||
NewLoadSceneStop()
|
|
||||||
SetPedCoordsKeepVehicle(ped, x, y, z)
|
|
||||||
|
|
||||||
while not HasCollisionLoadedAroundEntity(ped) do
|
|
||||||
RequestCollisionAtCoord(x, y, z)
|
|
||||||
if GetGameTimer() - curTime > 1000 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
Wait(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get ground coord. As mentioned in the natives, this only works if the client is in render distance.
|
|
||||||
found, groundZ = GetGroundZFor_3dCoord(x, y, z, false)
|
|
||||||
if found then
|
|
||||||
Wait(0)
|
|
||||||
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
Wait(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove black screen once the loop has ended.
|
|
||||||
DoScreenFadeIn(650)
|
|
||||||
if vehicle > 0 then
|
|
||||||
FreezeEntityPosition(vehicle, false)
|
|
||||||
else
|
|
||||||
FreezeEntityPosition(ped, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not found then
|
|
||||||
-- If we can't find the coords, set the coords to the old ones.
|
|
||||||
-- We don't unpack them before since they aren't in a loop and only called once.
|
|
||||||
SetPedCoordsKeepVehicle(ped, oldCoords['x'], oldCoords['y'], oldCoords['z'] - 1.0)
|
|
||||||
ESX.ShowNotification('Successfully Teleported', true, false, 140)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If Z coord was found, set coords in found coords.
|
|
||||||
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
|
|
||||||
ESX.ShowNotification('Successfully Teleported', true, false, 140)
|
|
||||||
end
|
end
|
||||||
|
local blipMarker = GetFirstBlipInfoId(8)
|
||||||
|
if not DoesBlipExist(blipMarker) then
|
||||||
|
ESX.ShowNotification(TranslateCap('tpm_nowaypoint'), true, false, 140)
|
||||||
|
return 'marker'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fade screen to hide how clients get teleported.
|
||||||
|
DoScreenFadeOut(650)
|
||||||
|
while not IsScreenFadedOut() do
|
||||||
|
Wait(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
local ped, coords = ESX.PlayerData.ped, GetBlipInfoIdCoord(blipMarker)
|
||||||
|
local vehicle = GetVehiclePedIsIn(ped, false)
|
||||||
|
local oldCoords = GetEntityCoords(ped)
|
||||||
|
|
||||||
|
-- Unpack coords instead of having to unpack them while iterating.
|
||||||
|
-- 825.0 seems to be the max a player can reach while 0.0 being the lowest.
|
||||||
|
local x, y, groundZ, Z_START = coords['x'], coords['y'], 850.0, 950.0
|
||||||
|
local found = false
|
||||||
|
FreezeEntityPosition(vehicle > 0 and vehicle or ped, true)
|
||||||
|
|
||||||
|
for i = Z_START, 0, -25.0 do
|
||||||
|
local z = i
|
||||||
|
if (i % 2) ~= 0 then
|
||||||
|
z = Z_START - i
|
||||||
|
end
|
||||||
|
|
||||||
|
NewLoadSceneStart(x, y, z, x, y, z, 50.0, 0)
|
||||||
|
local curTime = GetGameTimer()
|
||||||
|
while IsNetworkLoadingScene() do
|
||||||
|
if GetGameTimer() - curTime > 1000 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
Wait(0)
|
||||||
|
end
|
||||||
|
NewLoadSceneStop()
|
||||||
|
SetPedCoordsKeepVehicle(ped, x, y, z)
|
||||||
|
|
||||||
|
while not HasCollisionLoadedAroundEntity(ped) do
|
||||||
|
RequestCollisionAtCoord(x, y, z)
|
||||||
|
if GetGameTimer() - curTime > 1000 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
Wait(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get ground coord. As mentioned in the natives, this only works if the client is in render distance.
|
||||||
|
found, groundZ = GetGroundZFor_3dCoord(x, y, z, false)
|
||||||
|
if found then
|
||||||
|
Wait(0)
|
||||||
|
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
Wait(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove black screen once the loop has ended.
|
||||||
|
DoScreenFadeIn(650)
|
||||||
|
FreezeEntityPosition(vehicle > 0 and vehicle or ped, false)
|
||||||
|
|
||||||
|
if not found then
|
||||||
|
-- If we can't find the coords, set the coords to the old ones.
|
||||||
|
-- We don't unpack them before since they aren't in a loop and only called once.
|
||||||
|
SetPedCoordsKeepVehicle(ped, oldCoords['x'], oldCoords['y'], oldCoords['z'] - 1.0)
|
||||||
|
ESX.ShowNotification(TranslateCap('tpm_success'), true, false, 140)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If Z coord was found, set coords in found coords.
|
||||||
|
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
|
||||||
|
ESX.ShowNotification(TranslateCap('tpm_success'), true, false, 140)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local noclip = false
|
local noclip = false
|
||||||
|
local noclip_pos = vector3(0, 0, 70)
|
||||||
|
local heading = 0
|
||||||
|
|
||||||
|
local function noclipThread()
|
||||||
|
while noclip do
|
||||||
|
SetEntityCoordsNoOffset(ESX.PlayerData.ped, noclip_pos.x, noclip_pos.y, noclip_pos.z, 0, 0, 0)
|
||||||
|
|
||||||
|
if IsControlPressed(1, 34) then
|
||||||
|
heading = heading + 1.5
|
||||||
|
if heading > 360 then
|
||||||
|
heading = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
SetEntityHeading(ESX.PlayerData.ped, heading)
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlPressed(1, 9) then
|
||||||
|
heading = heading - 1.5
|
||||||
|
if heading < 0 then
|
||||||
|
heading = 360
|
||||||
|
end
|
||||||
|
|
||||||
|
SetEntityHeading(ESX.PlayerData.ped, heading)
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlPressed(1, 8) then
|
||||||
|
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 1.0, 0.0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlPressed(1, 32) then
|
||||||
|
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, -1.0, 0.0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlPressed(1, 27) then
|
||||||
|
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, 1.0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlPressed(1, 173) then
|
||||||
|
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, -1.0)
|
||||||
|
end
|
||||||
|
Wait(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
RegisterNetEvent("esx:noclip")
|
RegisterNetEvent("esx:noclip")
|
||||||
AddEventHandler("esx:noclip", function(input)
|
AddEventHandler("esx:noclip", function(input)
|
||||||
ESX.TriggerServerCallback("esx:isUserAdmin", function(admin)
|
ESX.TriggerServerCallback("esx:isUserAdmin", function(admin)
|
||||||
if admin then
|
if not admin then
|
||||||
local player = PlayerId()
|
return
|
||||||
|
|
||||||
local msg = "disabled"
|
|
||||||
if(noclip == false)then
|
|
||||||
noclip_pos = GetEntityCoords(ESX.PlayerData.ped, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
noclip = not noclip
|
|
||||||
|
|
||||||
if(noclip)then
|
|
||||||
msg = "enabled"
|
|
||||||
end
|
|
||||||
|
|
||||||
TriggerEvent("chatMessage", "Noclip has been ^2^*" .. msg)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
local heading = 0
|
|
||||||
CreateThread(function()
|
|
||||||
while true do
|
|
||||||
local Sleep = 1500
|
|
||||||
|
|
||||||
if(noclip)then
|
|
||||||
Sleep = 0
|
|
||||||
SetEntityCoordsNoOffset(ESX.PlayerData.ped, noclip_pos.x, noclip_pos.y, noclip_pos.z, 0, 0, 0)
|
|
||||||
|
|
||||||
if(IsControlPressed(1, 34))then
|
|
||||||
heading = heading + 1.5
|
|
||||||
if(heading > 360)then
|
|
||||||
heading = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
SetEntityHeading(ESX.PlayerData.ped, heading)
|
|
||||||
end
|
|
||||||
|
|
||||||
if(IsControlPressed(1, 9))then
|
|
||||||
heading = heading - 1.5
|
|
||||||
if(heading < 0)then
|
|
||||||
heading = 360
|
|
||||||
end
|
|
||||||
|
|
||||||
SetEntityHeading(ESX.PlayerData.ped, heading)
|
|
||||||
end
|
|
||||||
|
|
||||||
if(IsControlPressed(1, 8))then
|
|
||||||
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 1.0, 0.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
if(IsControlPressed(1, 32))then
|
|
||||||
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, -1.0, 0.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
if(IsControlPressed(1, 27))then
|
|
||||||
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, 1.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
if(IsControlPressed(1, 173))then
|
|
||||||
noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, -1.0)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Wait(Sleep)
|
|
||||||
end
|
if not noclip then
|
||||||
|
noclip_pos = GetEntityCoords(ESX.PlayerData.ped, false)
|
||||||
|
heading = GetEntityHeading(ESX.PlayerData.ped)
|
||||||
|
end
|
||||||
|
|
||||||
|
noclip = not noclip
|
||||||
|
if noclip then
|
||||||
|
CreateThread(noclipThread)
|
||||||
|
end
|
||||||
|
|
||||||
|
ESX.ShowNotification(TranslateCap('noclip_message', noclip and "enabled" or "disabled"), true, false, 140)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("esx:killPlayer")
|
RegisterNetEvent("esx:killPlayer")
|
||||||
@@ -680,38 +669,32 @@ AddEventHandler("esx:freezePlayer", function(input)
|
|||||||
SetPlayerInvincible(player, true)
|
SetPlayerInvincible(player, true)
|
||||||
elseif input == 'unfreeze' then
|
elseif input == 'unfreeze' then
|
||||||
SetEntityCollision(ESX.PlayerData.ped, true)
|
SetEntityCollision(ESX.PlayerData.ped, true)
|
||||||
FreezeEntityPosition(ESX.PlayerData.ped, false)
|
FreezeEntityPosition(ESX.PlayerData.ped, false)
|
||||||
SetPlayerInvincible(player, false)
|
SetPlayerInvincible(player, false)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("esx:GetVehicleType", function(Model, Request)
|
RegisterNetEvent("esx:GetVehicleType", function(Model, Request)
|
||||||
local ReturnedType = "automobile"
|
if not IsModelInCdimage(Model) then
|
||||||
local Model = Model
|
return TriggerServerEvent("esx:ReturnVehicleType", false, Request)
|
||||||
local IsValidModel = IsModelInCdimage(Model)
|
end
|
||||||
if IsValidModel == true or IsValidModel == 1 then
|
|
||||||
local VehicleType = GetVehicleClassFromName(Model)
|
|
||||||
|
|
||||||
if VehicleType == 15 then
|
if Model == `submersible` or Model == `submersible2` then
|
||||||
ReturnedType = "heli"
|
return TriggerServerEvent("esx:ReturnVehicleType", "submarine", Request)
|
||||||
elseif VehicleType == 16 then
|
|
||||||
ReturnedType = "plane"
|
|
||||||
elseif VehicleType == 14 then
|
|
||||||
ReturnedType = "boat"
|
|
||||||
elseif VehicleType == 11 then
|
|
||||||
ReturnedType = "trailer"
|
|
||||||
elseif VehicleType == 21 then
|
|
||||||
ReturnedType = "train"
|
|
||||||
elseif VehicleType == 13 or VehicleType == 8 then
|
|
||||||
ReturnedType = "bike"
|
|
||||||
end
|
|
||||||
if Model == `submersible` or Model == `submersible2` then
|
|
||||||
ReturnedType = "submarine"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
ReturnedType = false
|
|
||||||
end
|
end
|
||||||
TriggerServerEvent("esx:ReturnVehicleType", ReturnedType, Request)
|
|
||||||
|
local VehicleType = GetVehicleClassFromName(Model)
|
||||||
|
local types = {
|
||||||
|
[8] = "bike",
|
||||||
|
[11] = "trailer",
|
||||||
|
[13] = "bike",
|
||||||
|
[14] = "boat",
|
||||||
|
[15] = "heli",
|
||||||
|
[16] = "plane",
|
||||||
|
[21] = "train",
|
||||||
|
}
|
||||||
|
|
||||||
|
TriggerServerEvent("esx:ReturnVehicleType", types[VehicleType] or "automobile", Request)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local DoNotUse = {
|
local DoNotUse = {
|
||||||
|
|||||||
@@ -108,6 +108,12 @@ Locales['en'] = {
|
|||||||
['command_giveammo_noweapon_found'] = '%s does not have that weapon',
|
['command_giveammo_noweapon_found'] = '%s does not have that weapon',
|
||||||
['command_giveammo_weapon'] = 'Weapon name',
|
['command_giveammo_weapon'] = 'Weapon name',
|
||||||
['command_giveammo_ammo'] = 'Ammo Quantity',
|
['command_giveammo_ammo'] = 'Ammo Quantity',
|
||||||
|
['tpm_nowaypoint'] = 'No Waypoint Set.',
|
||||||
|
['tpm_success'] = 'Successfully Teleported',
|
||||||
|
|
||||||
|
['noclip_message'] = 'Noclip has been %s',
|
||||||
|
['enabled'] = '~g~enabled~s~',
|
||||||
|
['disabled'] = '~r~disabled~s~',
|
||||||
|
|
||||||
-- Locale settings
|
-- Locale settings
|
||||||
['locale_digit_grouping_symbol'] = ',',
|
['locale_digit_grouping_symbol'] = ',',
|
||||||
|
|||||||
@@ -105,9 +105,15 @@ Locales["hu"] = {
|
|||||||
["commanderror_invalidcommand"] = "Érvénytelen parancs - /%s",
|
["commanderror_invalidcommand"] = "Érvénytelen parancs - /%s",
|
||||||
["commanderror_invalidplayerid"] = "Megadott játékos nem online.",
|
["commanderror_invalidplayerid"] = "Megadott játékos nem online.",
|
||||||
["commandgeneric_playerid"] = "Játékos Szerver Id",
|
["commandgeneric_playerid"] = "Játékos Szerver Id",
|
||||||
['command_giveammo_noweapon_found'] = '%s does not have that weapon',
|
['command_giveammo_noweapon_found'] = 'Nincs ilyen fegyvered: %s',
|
||||||
['command_giveammo_weapon'] = 'Weapon name',
|
['command_giveammo_weapon'] = 'Fegyver név',
|
||||||
['command_giveammo_ammo'] = 'Ammo Quantity',
|
['command_giveammo_ammo'] = 'Lőszer mennyiség',
|
||||||
|
['tpm_nowaypoint'] = 'Nincs kijelölve pozíció!',
|
||||||
|
['tpm_success'] = 'Sikeres teleportálás',
|
||||||
|
|
||||||
|
['noclip_message'] = 'Noclip %s',
|
||||||
|
['enabled'] = '~g~engedélyezve~s~',
|
||||||
|
['disabled'] = '~r~letiltva~s~',
|
||||||
|
|
||||||
-- Locale settings
|
-- Locale settings
|
||||||
["locale_digit_grouping_symbol"] = ",",
|
["locale_digit_grouping_symbol"] = ",",
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
Locales["hu"] = {
|
Locales["hu"] = {
|
||||||
["parking_blip_name"] = 'Garázs',
|
["parking_blip_name"] = 'Garázs',
|
||||||
["Impound_blip_name"] = 'Lefoglaltak',
|
["Impound_blip_name"] = 'Lefoglaltak',
|
||||||
["access_parking"] = 'Nyomd meg az [E] gombot a parkoló eléréshez.',
|
["access_parking"] = 'Nyomd meg az [E] gombot a parkoló megtekintéséhez.',
|
||||||
["access_Impound"] = 'Nyomd meg az [E] gombot a lefoglaltak megtekintéséhez.',
|
["access_Impound"] = 'Nyomd meg az [E] gombot a lefoglaltak megtekintéséhez.',
|
||||||
["park_veh"] = 'Nyomd meg az [E] gombot a jármű parkolásához.',
|
["park_veh"] = 'Nyomd meg az [E] gombot a jármű parkolásához.',
|
||||||
["not_owning_veh"] = 'Ez a jármű nem a te tulajdonod!',
|
["not_owning_veh"] = 'Ez a jármű nem a te tulajdonod!',
|
||||||
['veh_released'] = 'Jármű sikeresen kivéve.',
|
['veh_released'] = 'Sikeresen kivetted a járművet.',
|
||||||
['veh_Impound_released'] = 'Jármű sikeresen kiváltva a legfolalásból.',
|
['veh_Impound_released'] = 'Jármű sikeresen kiváltva a legfolalásból.',
|
||||||
['veh_stored'] = 'Jármű sikeresen tárolva',
|
['veh_stored'] = 'Jármű sikeresen tárolva',
|
||||||
['veh_impounded'] = 'Lefoglalt jármű',
|
['veh_impounded'] = 'Lefoglalt jármű megjelölve a térképen',
|
||||||
['no_veh_parking'] = 'Nincsenek itt tárolt járművek-',
|
['no_veh_parking'] = 'Nincsenek itt tárolt járművek.',
|
||||||
['no_veh_impounded'] = 'Nincs lefoglalt jármű.',
|
['no_veh_impounded'] = 'Nincs lefoglalt jármű.',
|
||||||
['no_veh_Impound'] = 'nincs lefoglalt járműved.',
|
['no_veh_Impound'] = 'nincs lefoglalt járműved.',
|
||||||
['veh_model'] = 'Model',
|
['veh_model'] = 'Model',
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ AddEventHandler('esx_garage:setImpound', function(Impound, vehicleProps)
|
|||||||
})
|
})
|
||||||
|
|
||||||
xPlayer.showNotification(TranslateCap('veh_impounded'))
|
xPlayer.showNotification(TranslateCap('veh_impounded'))
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user