Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: push for the release of version 1.0.0 #18

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions client/common.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
AddEventHandler('esx:getSharedObject', function(cb)
local Invoke = GetInvokingResource()
print(('[^3WARNING^7] ^5%s^7 used ^5esx:getSharedObject^7, this method is deprecated and should not be used! Refer to ^5https://bitpredator.github.io/bptdevelopment/docs/esx-tutorial/sharedevent^7 for more info!'):format(Invoke))
cb(ESX)
end)

exports('getSharedObject', function()
return ESX
end)

if GetResourceState('ox_inventory') ~= 'missing' then
Config.OxInventory = true
end
end

RegisterNetEvent('esx:getSharedObject', function()
print(('[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://bitpredator.github.io/bptdevelopment/docs/esx-tutorial/sharedevent for how to fix!'):format(GetInvokingResource))
end)
120 changes: 32 additions & 88 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)

local playerId = PlayerId()

-- RemoveHudCommonents
for i=1, #(Config.RemoveHudCommonents) do
if Config.RemoveHudCommonents[i] then
-- RemoveHudComponents
for i=1, #(Config.RemoveHudComponents) do
if Config.RemoveHudComponents[i] then
SetHudComponentPosition(i, 999999.0, 999999.0)
end
end
Expand All @@ -75,7 +75,7 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)

-- DisableVehicleRewards
if Config.DisableVehicleRewards then
AddEventHandler('esx:enteredVehicle', function(vehicle, _, _, _, _)
AddEventHandler('esx:enteredVehicle', function(vehicle)
if GetVehicleClass(vehicle) == 18 then
CreateThread(function()
while true do
Expand Down Expand Up @@ -103,6 +103,10 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
DisableControlAction(0, 37, true)
end

if Config.DisableDisplayAmmo then
DisplayAmmoThisFrame(false)
end

if Config.DisableAimAssist then
if IsPedArmed(ESX.PlayerData.ped, 4) then
SetPlayerLockonRangeOverride(playerId, 2.0)
Expand Down Expand Up @@ -263,7 +267,6 @@ if not Config.OxInventory then
RegisterNetEvent('esx:setWeaponTint')
AddEventHandler('esx:setWeaponTint', function(weapon, weaponTintIndex)
SetPedWeaponTintIndex(ESX.PlayerData.ped, joaat(weapon), weaponTintIndex)

end)

RegisterNetEvent('esx:removeWeapon')
Expand Down Expand Up @@ -355,7 +358,7 @@ function StartServerSyncLoops()
local sleep = 1500
if GetSelectedPedWeapon(ESX.PlayerData.ped) ~= -1569615261 then
sleep = 1000
local _,weaponHash = GetCurrentPedWeapon(ESX.PlayerData.ped, true)
local _, weaponHash = GetCurrentPedWeapon(ESX.PlayerData.ped, true)
local weapon = ESX.GetWeaponFromHash(weaponHash)
if weapon then
local ammoCount = GetAmmoInPedWeapon(ESX.PlayerData.ped, weaponHash)
Expand All @@ -371,76 +374,18 @@ function StartServerSyncLoops()
end
end
Wait(sleep)
end
end
end)
end
end

if not Config.OxInventory and Config.EnableDefaultInventory then
RegisterCommand('showinv', function()
if not ESX.PlayerData.dead and not ESX.UI.Menu.IsOpen('default', 'es_extended') then
ESX.ShowInventory()
end
end)

RegisterKeyMapping('showinv', _U('keymap_showinventory'), 'keyboard', 'F2')
end

-- disable wanted level
if not Config.EnableWantedLevel then
ClearPlayerWantedLevel(PlayerId())
SetMaxWantedLevel(0)
end

if not Config.OxInventory then
CreateThread(function()
while true do
local Sleep = 1500
local playerCoords = GetEntityCoords(ESX.PlayerData.ped)
local _, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)

for pickupId,pickup in pairs(pickups) do
local distance = #(playerCoords - pickup.coords)

if distance < 5 then
Sleep = 0
local label = pickup.label

if distance < 1 then
if IsControlJustReleased(0, 38) then
if IsPedOnFoot(ESX.PlayerData.ped) and (closestDistance == -1 or closestDistance > 3) and not pickup.inRange then
pickup.inRange = true

local dict, anim = 'weapons@first_person@aim_rng@generic@projectile@sticky_bomb@', 'plant_floor'
ESX.Streaming.RequestAnimDict(dict)
TaskPlayAnim(ESX.PlayerData.ped, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
RemoveAnimDict(dict)
Wait(1000)

TriggerServerEvent('esx:onPickup', pickupId)
PlaySoundFrontend(-1, 'PICK_UP', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false)
end
end

label = ('%s~n~%s'):format(label, _U('threw_pickup_prompt'))
end

ESX.Game.Utils.DrawText3D({
x = pickup.coords.x,
y = pickup.coords.y,
z = pickup.coords.z + 0.25
}, label, 1.2, 1)
elseif pickup.inRange then
pickup.inRange = false
end
end
Wait(Sleep)
end
end)
end

----- Admin commnads from esx_adminplus

RegisterNetEvent("esx:tpm")
AddEventHandler("esx:tpm", function()
local GetEntityCoords = GetEntityCoords
Expand All @@ -458,52 +403,52 @@ AddEventHandler("esx:tpm", function()
ESX.ShowNotification(_U('nowaipoint'), 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)
FreezeEntityPosition(vehicle, true)
else
FreezeEntityPosition(ped, true)
FreezeEntityPosition(ped, true)
end

for i = Z_START, 0, -25.0 do
local z = i
if (i % 2) ~= 0 then
z = Z_START - i
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)
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)
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
Expand All @@ -513,22 +458,22 @@ AddEventHandler("esx:tpm", function()
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(_U('tpm_success'), true, false, 140)
end

-- If Z coord was found, set coords in found coords.
SetPedCoordsKeepVehicle(ped, x, y, groundZ)
ESX.ShowNotification(_U('tpm_success'), true, false, 140)
Expand Down Expand Up @@ -574,7 +519,6 @@ end)

RegisterNetEvent("esx:GetVehicleType", function(Model, Request)
local ReturnedType = "automobile"
local Model = Model
local IsValidModel = IsModelInCdimage(Model)
if IsValidModel == true or IsValidModel == 1 then
local VehicleType = GetVehicleClassFromName(Model)
Expand Down
2 changes: 1 addition & 1 deletion dependencies/hardcap/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AddEventHandler('playerDropped', function()
end)

AddEventHandler('playerConnecting', function(name, setReason)
local cv = GetConvarInt('sv_maxclients', 32)
local cv = GetConvarInt('sv_maxclients', 48)

print('Connecting: ' .. name .. '^7')

Expand Down
19 changes: 4 additions & 15 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ game 'gta5'
description 'ES Extended'

lua54 'yes'
version '0.0.4'
version '1.0.0'

shared_scripts {
'locale.lua',
Expand Down Expand Up @@ -46,25 +46,14 @@ client_scripts {
'dependencies/hardcap/client/*.lua'
}

ui_page {
'html/ui.html'
}

files {
'imports.lua',
'locale.js',
'html/ui.html',
'html/css/app.css',
'html/js/mustache.min.js',
'html/js/wrapper.js',
'html/js/app.js',
'html/fonts/pdown.ttf',
'html/fonts/bankgothic.ttf'
'locale.js'
}

dependencies {
'/server:5949',
'/onesync',
'/native:0x6AE51D4B',
'oxmysql',
'spawnmanager',
'ox_inventory',
}
75 changes: 0 additions & 75 deletions html/css/app.css

This file was deleted.

Binary file removed html/fonts/bankgothic.ttf
Binary file not shown.
Binary file removed html/fonts/pdown.ttf
Binary file not shown.
Loading
Loading