im not sure how i can pass a true or false from the server to the client.
Thanks
im not sure how i can pass a true or false from the server to the client.
Thanks
Use client and server events.
could you give me an example:D
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.