Plate Posted April 24, 2013 Share Posted April 24, 2013 Hola podria esto funcionar? es para agregar el item de Vida a mi inventario function itemHealth() local itemH = getElementData(localPlayer, "Itemh") if itemH > 0 then local row = guiGridListAddRow(itemGrid) guiGridListSetItemText ( itemGrid, row, 1, "Vida + 50", false, false ) guiGridListSetItemText ( itemGrid, row, 2, tonumber(itemH)..", false, false ) end end Link to comment
Castillo Posted April 24, 2013 Share Posted April 24, 2013 guiGridListSetItemText ( itemGrid, row, 2, tonumber(itemH)..", false, false ) Esta mal esa linea, deberia ser: guiGridListSetItemText ( itemGrid, row, 2, tostring(itemH), false, false ) Link to comment
Plate Posted April 24, 2013 Author Share Posted April 24, 2013 function useItemHealth() local row, col = guiGridListGetSelectedItem ( itemGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local itemH = guiGridListGetItemText ( itemGrid, row, 1 ) if (itemH == "Vida") then setElementHealth(localPlayer, 100) end end end addEventHandler("onClientGUIClcik", Usar, useItemHealth, false) Link to comment
Sasu Posted April 24, 2013 Share Posted April 24, 2013 Escribiste mal el evento: addEventHandler("onClientGUIClcik", Usar, useItemHealth, false) Debe ser asi addEventHandler("onClientGUIClick", Usar, useItemHealth, false) Link to comment
Plate Posted April 24, 2013 Author Share Posted April 24, 2013 Toco el boton pero no pasa nada Link to comment
Sasu Posted April 24, 2013 Share Posted April 24, 2013 Estas seguro que en el row dice 'Vida' no? Igual proba asi: function useItemHealth() if source == Usar then local row, col = guiGridListGetSelectedItem ( itemGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local itemH = guiGridListGetItemText ( itemGrid, row, 1 ) if (itemH == "Vida") then setElementHealth(localPlayer, 100) end end end end addEventHandler("onClientGUIClick", root, useItemHealth) Link to comment
Plate Posted April 25, 2013 Author Share Posted April 25, 2013 si el row 1 dice "Vida" pero nose por que no anda Link to comment
Plate Posted April 26, 2013 Author Share Posted April 26, 2013 Mira la foto no dropea el item ni lo usa nose por que Nisiquiera da error Link to comment
Recommended Posts