Welcome to the forum, Guest

To access forum content and all of our services, you must register or log in to the forum. Joining the forum and all content on the forum is completely free.

The world's largest FiveM Forum and GTA 5 Forum address

Hello dear member,
We work 24/7 to provide the most valuable content that will be of use to you,
you can share content and support the entire FiveM & GTA 5 mods.

Request CAN ANYONE CONVERT THIS TO ESX?

ufukk123

Member
Joined
Aug 11, 2021
Messages
2
Reaction score
0
Points
146
RegisterNUICallback("GiveItem", function(data, cb)

local player, distance = GetClosestPlayer()

if player ~= -1 and distance < 2.5 then

local playerPed = GetPlayerPed(player)

local playerId = GetPlayerServerId(player)

local plyCoords = GetEntityCoords(playerPed)

local pos = GetEntityCoords(GetPlayerPed(-1))

local dist = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, plyCoords.x, plyCoords.y, plyCoords.z, true)

if dist < 2.5 and givelock == true then

SetCurrentPedWeapon(PlayerPedId(),'WEAPON_UNARMED',true)

TriggerServerEvent("inventory:server:GiveItem", playerId, data.inventory, data.item, data.amount)

print(data.amount)

elseif givelock== false then

QBCore.Functions.Notify("İtemi Veremezsin!", "error")

else

QBCore.Functions.Notify("Yakında Kimse Yok!", "error")

end

else

QBCore.Functions.Notify("No one nearby!", "error")

end

end)
 

Xerarch#1801

Bronze Elite
Joined
May 7, 2021
Messages
7
Reaction score
2
Points
146
Seriously, there's 4 things to change... How are you even planning on being a server owner / developer if you don't know how to change such a simple thing.

PHP:
// Change this to what ever notification system you are using or to original ESX notification system
QBCore.Functions.Notify("No one nearby!", "error")
    
//  https://esx-framework.github.io/es_extended/client/functions/shownotification/

// Change this too the ESX function instead
local player, distance = GetClosestPlayer()

// https://esx-framework.github.io/es_extended/client/functions/game/getclosestplayer/

You could've literally just googled the function for ESX and you get a full document explaining all of it.
 

Skyllake

Member
Joined
Mar 20, 2021
Messages
9
Reaction score
1
Points
156
True, if you would just take a look at any kinds of Documentation or Wiki that come's with ESX, QBase, and almost every released framework.
 

Login or register to get more out of the forum!

Login or register to get more out of the forum!

Register

Creating an account on the forum is completely free.

Register now
Log in

If you have an account, please login

Log in

Theme editor

Theme customizations

Graphic Backgrounds

Granite Backgrounds