Jump to content

GetStreamedElements


Maggi

Recommended Posts

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
--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

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

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...