Jump to content

Reciving empty table at client?


.:HyPeX:.

Recommended Posts

Well hello, i'm sending a 75 object table to the client wich are all resource elements. However, when the table reaches the client is empty, tried using the resource names instead and it worked.

So i'm assuming the reason is resource elements cant be sent via triggerElements, but it is said in the wiki "Any lua data type except functions", so i dont know why it isnt working?

Server:

addCommandHandler('maps',function() 
local MapList = exports.mapmanager:getMapsCompatibleWithGamemode ( getResourceFromName('race') ) 
outputChatBox(#MapList) 
triggerClientEvent(root,'maps', resourceRoot,MapList) 
end) 

Client:

addEvent('maps',true) 
addEventHandler('maps',root,function(maps) 
outputChatBox(#maps) 
end) 

Output:

75 
0 

Greetz

HyPeX

Edited by Guest
Link to comment
You have sent 'list' but your variable is 'MapList'.

My bad, i actually have fixed it in my script, i just was testing another thing in the meanwhile and forgot to set the variable back here :lol:

addCommandHandler('maps',function()

local MapList = exports.mapmanager:getMapsCompatibleWithGamemode ( getResourceFromName('race') )

local list = {}

for i=1, #MapList do

table.insert(list, getResourceName(MapList))

end

triggerClientEvent(root,'maps', resourceRoot,list)

end)

EDITED OP, still looking on the issue why i cant send the direct resource pointer..

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...