Skip to content

Commit

Permalink
chore: use PlayerPedId() instead of GetPlayerPed(-1)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Aug 19, 2024
1 parent dc036c7 commit e5b0561
Showing 3 changed files with 223 additions and 313 deletions.
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ AddEventHandler("esx:setJob", function(job)
end)

local function isPedDrivingAVehicle()
local ped = GetPlayerPed(-1)
local ped = PlayerPedId()
vehicle = GetVehiclePedIsIn(ped, false)
if IsPedInAnyVehicle(ped, false) then
-- Check if ped is in driver seat
@@ -221,7 +221,7 @@ end
Citizen.CreateThread(function()
while true do
Citizen.Wait(50)
local ped = GetPlayerPed(-1)
local ped = PlayerPedId()
if isPedDrivingAVehicle() then
vehicle = GetVehiclePedIsIn(ped, false)
vehicleClass = GetVehicleClass(vehicle)
20 changes: 10 additions & 10 deletions server-data/resources/[bpt_addons]/bpt_carshowroom/client/main.lua
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ function OpenShopMenu()

ESX.UI.Menu.CloseAll()

local playerPed = GetPlayerPed(-1)
local playerPed = PlayerPedId()

FreezeEntityPosition(playerPed, true)
SetEntityVisible(playerPed, false)
@@ -205,10 +205,10 @@ function OpenShopMenu()
if data2.current.value == "no" then
menu2.close()
end
end, function(data2, menu2)
end, function(_, menu2)
menu2.close()
end)
end, function(data, menu)
end, function(_, menu)
menu.close()

DoScreenFadeOut(1000)
@@ -217,7 +217,7 @@ function OpenShopMenu()

DeleteKatalogVehicles()

local playerPed = GetPlayerPed(-1)
local playerPed = PlayerPedId()

CurrentAction = "shop_menu"
CurrentActionMsg = "shop menu"
@@ -231,7 +231,7 @@ function OpenShopMenu()
IsInShopMenu = false
end, function(data, menu)
local vehicleData = vehiclesByCategory[data.current.name][data.current.value + 1]
local playerPed = GetPlayerPed(-1)
local playerPed = PlayerPedId()

DeleteKatalogVehicles()

@@ -285,15 +285,15 @@ Citizen.CreateThread(function()
end

if CurrentAction == "go_down_from" then
local playerPed = GetPlayerPed(-1)
local playerPed = PlayerPedId()
DoScreenFadeOut(3000)
Wait(3000)
DoScreenFadeIn(3000)
SetEntityCoords(playerPed, Config.Zones.GoUpFrom.Pos.x, Config.Zones.GoUpFrom.Pos.y, Config.Zones.GoUpFrom.Pos.z)
end

if CurrentAction == "goTranslateCapp_from" then
local playerPed = GetPlayerPed(-1)
local playerPed = PlayerPedId()
DoScreenFadeOut(3000)
Wait(3000)
DoScreenFadeIn(3000)
@@ -312,9 +312,9 @@ Citizen.CreateThread(function()
while true do
Wait(0)

local coords = GetEntityCoords(GetPlayerPed(-1))
local coords = GetEntityCoords(PlayerPedId())

for k, v in pairs(Config.Zones) do
for _, v in pairs(Config.Zones) do
if v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance then
DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
end
@@ -327,7 +327,7 @@ Citizen.CreateThread(function()
while true do
Wait(0)

local coords = GetEntityCoords(GetPlayerPed(-1))
local coords = GetEntityCoords(PlayerPedId())
local isInMarker = false
local currentZone = nil

Loading

0 comments on commit e5b0561

Please sign in to comment.