Jump to content

how show maps name in GridList , please help


ABu-ALi_

Recommended Posts

Posted

i Search for it and i found this code :

function mapsList() 
local resourceTable = getResources() 
     for resourceKey, resourceValue in ipairs(resourceTable) do 
          local name = getResourceName(resourceValue) 
          local type = getResourceInfo ( resourceValue, "type" ) 
          if type == "map" then 
          triggerClientEvent ( "sendMaps", getRootElement(), name) 
          else 
          cancelEvent() 
        end 
    end 
end 

but what do the server client event? :(

please help me :(

Posted

If you really don't know how to start you can check default resource called "admin" in your "resources" folder and there somewhere should be clientside file which adds maps to the gridlist.

Posted

this my client code :

function sendmaps(name) 
mapGridList = guiCreateGridList(7,12,183,350,false,tab6) 
mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) 
guiGridListSetSelectionMode(mapGridList,2) 
for id, name in ipairs(maps) do 
row = guiGridListAddRow ( mapGridList ) 
guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) 
end 
addEventHandler( "sendMaps", mapGridList, sendmaps ) 

but , this code not working :(

please help me ... :(

  • Moderators
Posted

Hi,

Try this:

Server-Side:

function mapsList() 
    local resourceTable = getResources() 
    triggerClientEvent ( "clearGridList", getRootElement() ) 
    for resourceKey, resourceValue in ipairs(resourceTable) do 
          local name = getResourceName(resourceValue) 
          local type1 = getResourceInfo ( resourceValue, "type" ) 
          if type1 == "map" then 
            triggerClientEvent ( "sendMaps", getRootElement(), name) 
          else 
            cancelEvent() 
        end 
    end 
end 
addCommandHandler( "sendMaps", mapsList, false, false ) 

Client-Side:

--- Put here all your GUI and use guiSetVisible to show or hide the GUI 
mapGridList = guiCreateGridList(7,12,183,350,false,tab6) 
mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) 
guiGridListSetSelectionMode(mapGridList,2) 
  
addEvent("sendMaps", true ) 
function sendmaps(name) 
    row = guiGridListAddRow ( mapGridList ) 
    guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) 
end 
addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) 
  
addEvent( "clearGridList", true ) 
function clearGridList() 
    guiGridListClear( mapGridList ) 
end 
addEventHandler( "clearGridList", getLocalPlayer(), clearGridList ) 

Posted

Try this:

-- It's serverside

function mapsList() 
    local resourceTable = getResources() 
    triggerClientEvent ( "clearGridList", getRootElement() ) 
    for resourceKey, resourceValue in ipairs(resourceTable) do 
          local name = getResourceName(resourceValue) 
          local type1 = getResourceInfo ( resourceValue, "type" ) 
          local gamemode1 = getResourceInfo ( resourceValue, "gamemodes" ) 
          if type1 == "map" and gamemode1 == "race" then 
            triggerClientEvent ( "sendMaps", getRootElement(), name) 
          else 
            cancelEvent() 
        end 
    end 
end 
addCommandHandler( "sendMaps", mapsList, false, false ) 

Posted

كنت بعطيك اياه ^^

i made like this yesterday ^^

and as always Citizen and Solidsnake14 are the Best ^^

  • Moderators
Posted
كنت بعطيك اياه ^^

i made like this yesterday ^^

and as always Citizen and Solidsnake14 are the Best ^^

Thank you very much UAEpro :oops:

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