Jump to content

Question


Recommended Posts

Hello , I want to ask a question ..

can i get the file resource for each player when he open a window in grid list

like guieditor mod but get the folder for each player

for example i have 2 resources in my resource File 

Resource1

Resource2
i want to get them in gridlist ..

can i do it ?

Link to comment
getResources() -- with this function you get all the resources
triggerClientEvent() --to send the resources to the client

--[[ Example ( NOT TESTED ) ]]

--SERVER
function getAllResources()
  local RES_TABLE = getResources()
  if not ( RES_TABLE and type( RES_TABLE ) == "table" ) then
    --output an error
    return false
  end 
  triggerClientEvent( source --[[ change source with your player element ]], "client.sendResources", source --[[ same here ]], RES_TABLE )
end
--here add an event/command handler 

--CLIENT
addEvent( "client.sendResources", true ) -- add the cliend-sided event

function resNames_guiElements( RES_TABLE )
  local COLUMN_WIDTH = 50
  
  --Gridlist initialisation
  GRIDLIST = guiCreateGridList( --[[ fill here with the parameters ]] )
  guiGridListAddColumn( GRIDLIST, "Resources", COLUMN_WIDTH )
  
  for _, RESOURCE in ipairs ( RES_TABLE ) do -- Create the rows with the resources names
    local RES_NAME = getResourceName( RESOURCE )
    guiGridListAddRow( GRIDLIST, RES_NAME )
  end 
end 
addEventHandler( "client.sendResources", getRootElement(), resNames_guiElements )

 

 

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