When i get home i will show you. If you search up my k9 i do some of server to client.
Alright np great script btw
i dont understand what to look for or i wouldxD
Any events on the server called TriggerClientEvent is passing data on the k9.
ok ill look
20Characters
TriggerClientEvent("K9:SearchVehicle", src, K9Config.Items)
Src is the client to target and K9Config.Items is the table im passing from the config.
so just change the src to whatever my var is then set like new var = that var? confused
Src is a players id. Change src to source and pass your true / false over my k9config.items.
ok so like
cause im trying to see if they have the items from the inventory so i made a event that checks it the changes has to true or false
TriggerClientEvent(“esx_crafting:giveWeapon”, source, has)
Do you know how to register a client event.
edited that part up there so like that?
Yeah the K9:SearchVehicle is a register net event on the client.
Do i need the source part to just pass the true or false?
So something like this?
Server.lua
RegisterServerEvent(‘esx_crafting:check’)
AddEventHandler(‘esx_crafting:check’, function()
local xPlayer = ESX.GetPlayerFromId(source)
local BarrelQuantity = xPlayer.getInventoryItem(‘barrel_pooch’).count
local FrameQuantity = xPlayer.getInventoryItem(‘frame’).count
local StockQuantity = xPlayer.getInventoryItem(‘stock’).count
if BarrelQuantity >= 1 and FrameQuantity >= 1 and StockQuantity >= 1 and not BarrelQuantity == nil and not FrameQuantity == nil and not StockQuantity == nil then
has = true
TriggerClientEvent("esx_crafting:pass", has)
else
has = false
end
end)
Client
RegisterNetEvent(‘esx_crafting:pass’)
AddEventHandler(‘esx_crafting:pass’, function(has)
hasS = has
end)
TriggerClientEvent(“event”, HAS_TO_HAVE_AN_ID, has)
so i do have to put source there?
I added source there still didn’t work
ah. ok. source only exists when a server event is called from the client. You need to put your server id as where source is.
ok ill give that a shot
Hmm nope that makes it throw a native error should there be a space?
Server
RegisterServerEvent(‘esx_crafting:check’)
AddEventHandler(‘esx_crafting:check’, function()
local xPlayer = ESX.GetPlayerFromId(source)
local _source = source
local BarrelQuantity = xPlayer.getInventoryItem(‘barrel_pooch’).count
local FrameQuantity = xPlayer.getInventoryItem(‘frame’).count
local StockQuantity = xPlayer.getInventoryItem(‘stock’).count
if BarrelQuantity ~= 0 then
if FrameQuantity ~= 0 then
if StockQuantity ~= 0 then
has = true
TriggerClientEvent("esx_crafting:pass", serverID, has)
PlayersTransformingCombine[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('rifling_combine'))
TransformCombine(_source)
else
has = false
end
end
end
end)
Client.lua
RegisterNetEvent(‘esx_crafting:pass’)
AddEventHandler(‘esx_crafting:pass’, function(has)
hasS = has
end)
then i have
if hasS == true then
have any clue whats wrong with that
?