Plate Posted April 24, 2013 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
Castillo Posted April 24, 2013 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 )
Plate Posted April 24, 2013 Author 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)
Sasu Posted April 24, 2013 Posted April 24, 2013 Escribiste mal el evento: addEventHandler("onClientGUIClcik", Usar, useItemHealth, false) Debe ser asi addEventHandler("onClientGUIClick", Usar, useItemHealth, false)
Sasu Posted April 24, 2013 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)
Plate Posted April 25, 2013 Author Posted April 25, 2013 si el row 1 dice "Vida" pero nose por que no anda
Plate Posted April 26, 2013 Author Posted April 26, 2013 Mira la foto no dropea el item ni lo usa nose por que Nisiquiera da error
Recommended Posts