Y_Boss
1
Hello to this community.How can i pass a variable back to my client script?I give the server the ped with this :
RegisterNetEvent("house:OpenStorage")
AddEventHandler("house:OpenStorage",function()
TriggerEvent('chatMessage','test')
local id = TriggerServerEvent("loaf_housing:giveid")
exports["mf-inventory"]:openOtherInventory(id)
end)
RegisterNetEvent("house:createStorage")
AddEventHandler("house:getIdentity",function()
local ped = GetPlayerPed()
TriggerServerEvent("house:makeStorage",ped)
end)
and the server prints the steamID correctly…now i want to give this steam id back to my client so it can open his unique inventory.Any suggestions? this is the server code aswell
RegisterServerEvent('house:makeStorage')
AddEventHandler('house:makeStorage', function(ped)
local xPlayer = ESX.GetPlayerFromId(source)
local identifiers = GetPlayerIdentifiers(source,2)
id = table.unpack(identifiers)
print(tostring(id))
local uniqueIdentifier = id -- Unique identifier for this inventory.
local inventoryType = "inventory" -- Inventory type. Default is "inventory", other types are "shop" and "recipe".
local inventorySubType = "housing" -- Inventory sub-type, used to modify degrade modifiers by the config table.
local inventoryLabel = "house_storage" -- The inventorys UI label index (which will pull the translation value).
local maxWeight = 250.0 -- Max weight for the inventory.
local maxSlots = 50 -- Max slots for the inventory.
local items = exports["mf-inventory"]:createInventory(uniqueIdentifier,inventoryType,inventorySubType,inventoryLabel,maxWeight,maxSlots,items)
end)
Use ESX.RegisterServerCallback on Serverside
and
use ESX.TriggerServerCallback Clientside
Examples how to use it are on the Linked Pages
system
Closed
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.