Hi Can someone help me pls. I am new in creating fivem serwera and I don’t know how to create target on player. I use ox_target
What kind of target do you need?
Like handcuffs?
well, just for someone, e.g. to pick someone up, so that the target is displayed on the player and you can add an event to the script there. You can show two, e.g. under item, how to make it target only if you have an item
u can find these scripts online
I don’t mean this one is perfect. I just gave an example. I would like to simply make a mark on a player from any script so that he can simply add an event there
U can use something like this
-- [ Options table for the target ]
local options = {
{
name = 'wx_steal:main',
distance = 2,
icon = wx.Options.targetIcon,
label = wx.Options.targetText,
-- You may uncomment this function to automatically hide the target if player cannot be searched (is not dead etc...)
-- canInteract = function (entity)
-- if not canOpenTarget(entity) then
-- return false
-- end
-- return true
-- end,
onSelect = function (data)
if canOpenTarget(data.entity) then
TriggerServerEvent('wx_steal:showNotif',GetPlayerServerId(NetworkGetPlayerIndexFromPed(data.entity)))
-- [ Check if progress bar is enabled ]
if wx.Progress then
if lib.progressBar({
duration = wx.ProgressLength,
label = wx.Options.progressText,
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = {
car = true,
move = true,
combat = true,
},
anim = {
dict = 'anim@gangops@facility@servers@bodysearch@',
clip = 'player_search'
},
}) then
-- [ OX Inventory export used to open nearby player's inventory ]
exports.ox_inventory:openNearbyInventory()
else
-- [ If player cancels the progress bar ]
lib.notify({
title = wx.Options.notifyTitle,
description = wx.Options.notifyCancelled,
type = 'error',
position = 'top'
})
end
else
exports.ox_inventory:openNearbyInventory()
end
else
-- [ If player cannot be searched throw an error ]
lib.notify({
title = wx.Options.notifyTitle,
description = wx.Options.notifyUnavailable,
type = 'error',
position = 'top'
})
end
end
},
}
-- [ Apply the options for all players ]
exports.ox_target:addGlobalPlayer(options)