Peti Posted January 29, 2019 Share Posted January 29, 2019 Well, the title is self explanatory. How I do that? I have a list with the click event, but I want to allow the user to navigate said list with arrows up and down. Also, I need to trigger the event aswell. P.S: BTW, how I get the name of each skin? I must do it by hand? local tablaSkins = getValidPedModels() local listaPedsDisponibles = guiCreateGridList(0.04, 0.1, 0.4, 0.78, true, ventanaCrearPed) local columnaSkins = guiGridListAddColumn(listaPedsDisponibles, 'Skins', 0.75) if (columnaSkins) then for _, skin in pairs(tablaSkins) do local fila = guiGridListAddRow(listaPedsDisponibles, skin) guiGridListSetItemText(listaPedsDisponibles, fila, columnaSkins, skin, false, true) end end addEventHandler('onClientGUIClick', listaPedsDisponibles, function(boton, estado) if boton == 'left' and estado == 'up' then local skinPed = guiGridListGetItemText(listaPedsDisponibles, guiGridListGetSelectedItem(listaPedsDisponibles), 1) setElementModel(localPlayer, skinPed) end end Link to comment
Peti Posted January 29, 2019 Author Share Posted January 29, 2019 (edited) EDIT First part done by myself, sorry: function clickIzquierdo(boton, estado) if boton == 'left' and estado == 'up' then local skinPed = guiGridListGetItemText(listaPedsDisponibles, guiGridListGetSelectedItem(listaPedsDisponibles), 1) setElementModel(localPlayer, skinPed) end end addEventHandler('onClientGUIClick', listaPedsDisponibles, clickIzquierdo) function flechas(boton, estado) if estado == true then local filaSeleccionada, columnaSeleccionada = guiGridListGetSelectedItem(listaPedsDisponibles) if boton == 'arrow_u' then guiGridListSetSelectedItem(listaPedsDisponibles, filaSeleccionada - 1, columnaSeleccionada, true) setElementModel(localPlayer, guiGridListGetItemText(listaPedsDisponibles, filaSeleccionada - 1, columnaSeleccionada)) elseif boton =='arrow_d' then guiGridListSetSelectedItem(listaPedsDisponibles, filaSeleccionada + 1, columnaSeleccionada, true) setElementModel(localPlayer, guiGridListGetItemText(listaPedsDisponibles, filaSeleccionada + 1, columnaSeleccionada)) end if filaSeleccionada == -1 then guiGridListSetSelectedItem(listaPedsDisponibles, 0, 1, true) end end end addEventHandler('onClientKey', root, flechas) Now, I need to know about the second part. Edited January 29, 2019 by Peti Link to comment
WorthlessCynomys Posted January 29, 2019 Share Posted January 29, 2019 As far as I know, there is not a function present for skin names. You would have to implement a table with the IDs and the names associated with them. Link to comment
Mr.Loki Posted January 29, 2019 Share Posted January 29, 2019 You can find all of the ped names from within the freeroam resource in skins.xml 1 Link to comment
Peti Posted January 29, 2019 Author Share Posted January 29, 2019 5 hours ago, Mr.Loki said: You can find all of the ped names from within the freeroam resource in skins.xml MVP right here. Thanks! 1 1 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