ABu-ALi_ Posted March 5, 2011 Share Posted March 5, 2011 hi all . please help me for maps name in GridList i try but i dont know how i want show maps name in GridList please help me Link to comment
Castillo Posted March 5, 2011 Share Posted March 5, 2011 There was a topic about this, just search for it. Link to comment
ABu-ALi_ Posted March 5, 2011 Author Share Posted March 5, 2011 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 Link to comment
Castillo Posted March 5, 2011 Share Posted March 5, 2011 Yeah, i posted this code long ago, this was the hard part, now you gotta make the easy one yourself. Link to comment
proracer Posted March 5, 2011 Share Posted March 5, 2011 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. Link to comment
ABu-ALi_ Posted March 6, 2011 Author Share Posted March 6, 2011 I've tried to make a client code but I'm do not know how please help me in client code Link to comment
ABu-ALi_ Posted March 6, 2011 Author Share Posted March 6, 2011 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 ... Link to comment
proracer Posted March 6, 2011 Share Posted March 6, 2011 You're trying to iterate "maps" table but where is it? Link to comment
ABu-ALi_ Posted March 6, 2011 Author Share Posted March 6, 2011 i dont know how if you can help pleasee help plz Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 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 ) Link to comment
ABu-ALi_ Posted March 6, 2011 Author Share Posted March 6, 2011 its working thankkk you man but , Can you change it and make it appear only maps race ? Link to comment
proracer Posted March 6, 2011 Share Posted March 6, 2011 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 ) Link to comment
ABu-ALi_ Posted March 6, 2011 Author Share Posted March 6, 2011 its working thank you man you the best Link to comment
UAEpro Posted March 6, 2011 Share Posted March 6, 2011 كنت بعطيك اياه ^^ i made like this yesterday ^^ and as always Citizen and Solidsnake14 are the Best ^^ Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 كنت بعطيك اياه ^^i made like this yesterday ^^ and as always Citizen and Solidsnake14 are the Best ^^ Thank you very much UAEpro 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