depato123 Posted March 21, 2014 Posted March 21, 2014 Hola. tengo un problema con este resource Client: addEvent( "items:copy", true ) addEventHandler( "items:copy", localPlayer, function( ) exports.gui:hide() exports.gui:updateCopias( ) exports.gui:show( 'copia', true, false, true ) end ) Meta: function="updateCopias" type="client"/> El problema es este: No entiendo que sucede si en el archivo meta.xml del recurso gui exporto la funcion updateCopias. ¿alguien sabe porque pasa esto?
Alexs Posted March 21, 2014 Posted March 21, 2014 ¿Estas seguro de que la función 'updateCopias' no tiene errores?
depato123 Posted March 22, 2014 Author Posted March 22, 2014 Postea la función updateCopias Es este function updateCopias( ) windows.copia[2].panes = { } local t = exports.items:get( getLocalPlayer( ) ) if t then for k, v in ipairs( t ) do if v.item == 1 or v.item == 2 then local image = exports.items:getImage( v.item, v.value, v.name ) table.insert( windows.copia[2].panes, { image = image or ":players/images/skins/-1.png", onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( getKeyState( 'c' ) and { 255, 0, 0, 63 } or { 255, 255, 0, 63 } ) ) ) dxDrawText( "ID: "..v.value,pos[1], pos[2]-250, pos[3] - pos[1], pos[4] - pos[2], tocolor ( 255, 0, 0, 255 ), 1.02, "pricedown", "left", "top", false,false,true ) end, onClick = function( key ) if key == 1 then copias = copias+1 triggerServerEvent( "items:copy", getLocalPlayer( ), k, copias ) end end } ) end end end end
Alexs Posted March 22, 2014 Posted March 22, 2014 Postea la función updateCopias Es este function updateCopias( ) windows.copia[2].panes = { } local t = exports.items:get( getLocalPlayer( ) ) if t then for k, v in ipairs( t ) do if v.item == 1 or v.item == 2 then local image = exports.items:getImage( v.item, v.value, v.name ) table.insert( windows.copia[2].panes, { image = image or ":players/images/skins/-1.png", onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( getKeyState( 'c' ) and { 255, 0, 0, 63 } or { 255, 255, 0, 63 } ) ) ) dxDrawText( "ID: "..v.value,pos[1], pos[2]-250, pos[3] - pos[1], pos[4] - pos[2], tocolor ( 255, 0, 0, 255 ), 1.02, "pricedown", "left", "top", false,false,true ) end, onClick = function( key ) if key == 1 then copias = copias+1 triggerServerEvent( "items:copy", getLocalPlayer( ), k, copias ) end end } ) end end end end La función 'get' es server-side, no puedes utilizarla en client-side.
.:HyPeX:. Posted March 22, 2014 Posted March 22, 2014 Postea la función updateCopias Es este function updateCopias( ) windows.copia[2].panes = { } local t = exports.items:get( getLocalPlayer( ) ) if t then for k, v in ipairs( t ) do if v.item == 1 or v.item == 2 then local image = exports.items:getImage( v.item, v.value, v.name ) table.insert( windows.copia[2].panes, { image = image or ":players/images/skins/-1.png", onHover = function( cursor, pos ) dxDrawRectangle( pos[1], pos[2], pos[3] - pos[1], pos[4] - pos[2], tocolor( unpack( getKeyState( 'c' ) and { 255, 0, 0, 63 } or { 255, 255, 0, 63 } ) ) ) dxDrawText( "ID: "..v.value,pos[1], pos[2]-250, pos[3] - pos[1], pos[4] - pos[2], tocolor ( 255, 0, 0, 255 ), 1.02, "pricedown", "left", "top", false,false,true ) end, onClick = function( key ) if key == 1 then copias = copias+1 triggerServerEvent( "items:copy", getLocalPlayer( ), k, copias ) end end } ) end end end end La función 'get' es server-side, no puedes utilizarla en client-side. Calla, eso es una variable, no esta usando el GET en si. en cambio el call es client & server side.
depato123 Posted March 22, 2014 Author Posted March 22, 2014 Bueno, ya solucioné el problema. Gracias
Castillo Posted March 22, 2014 Posted March 22, 2014 Seria bueno que nos digas cual era el problema y como lo solucionaste.
Recommended Posts