Maggi Posted June 25, 2011 Share Posted June 25, 2011 I found only isElementStreamedIn() that is only on client side. Is it possible to create function GetStreamedElements(player, element_type) that returns table of streamed elemets. Example: local t[] = GetStreamedElements(player, ELEMENT_TYPE_VEHICLE); function should be serverside, not clientside. I found also server-side events: onElementStartSync and onElementStopSync. with them it is possible to manually fill table with player's streamed elements. but it will take some memory and time. Link to comment
JR10 Posted June 25, 2011 Share Posted June 25, 2011 you can do this for i, v in ipairs(getEkementsByType('vehicle')) do if isElementStreamedIn(v) then return v end end Link to comment
Maggi Posted June 25, 2011 Author Share Posted June 25, 2011 JR10, thanks, but: function should be serverside, not clientside. Link to comment
JR10 Posted June 25, 2011 Share Posted June 25, 2011 --server side local streamedElements = {} function GetStreamedElements(player, type) triggerClientEvent('streamedElements', root, type) end addEvent('insertStreamedElement', true) addEventHandler('insertStreamedElement', root, function(element) table.insert(streamedElements, element) end ) --client side addEvent('streamedElements', true) addEventHandler('streamedElements', root, function(type) for i, v in ipairs(getElementsByType(type)) do if isElementStreamedIn(v) then triggerServerEvent('insertStreamedElement', root, v) end end end ) if it worked then you will have a table "streamedElements" full of streamed elements server side whenever you use the function. Good luck. Link to comment
eAi Posted June 25, 2011 Share Posted June 25, 2011 You shouldn't need to care if a player has an element streamed in. Even if the server did know, it could easily be out of date by the time you did anything based on that information... The bandwidth required to tell the server would be pretty substantial. Why do you need to know? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now