Eistee Posted August 29, 2013 Posted August 29, 2013 I like to insert a picture in my gui window via link. Like so.. guiCreateStaticImage(1, 1, 1, 1, "http://images.tele.at/images/stories/EPG/small/990000041.jpg", false) Is there a solution?
Eistee Posted August 29, 2013 Author Posted August 29, 2013 Thanks But it doesnt work.. I have it so: fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false) function myCallback( responseData ) if fileExists("ice.png") then fileDelete("ice.png") end local file = fileCreate("ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "ice.png", TitelHintergrund) --Provide the XYs end
EstrategiaGTA Posted August 29, 2013 Posted August 29, 2013 Try with this. fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false) function myCallback( responseData ) if fileExists("wp-content/uploads/2010/05/ice.png") then fileDelete("wp-content/uploads/2010/05/ice.png") end local file = fileCreate("wp-content/uploads/2010/05/ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "wp-content/uploads/2010/05/ice.png", TitelHintergrund) --Provide the XYs end
Castillo Posted August 29, 2013 Posted August 29, 2013 ThanksBut it doesnt work.. I have it so: fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false) function myCallback( responseData ) if fileExists("ice.png") then fileDelete("ice.png") end local file = fileCreate("ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "ice.png", TitelHintergrund) --Provide the XYs end That's because fetchRemote client side can only access the same server the player is connected to. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted August 29, 2013 Posted August 29, 2013 You have to make the fetchRemote part server side and send the image data to the client side to create it. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Eistee Posted August 29, 2013 Author Posted August 29, 2013 I cant trigger... so? function img ( image ) image = fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false) end addEventHandler ( "getimage", getRootElement(), img ) addEvent ( "getimage", true )
Castillo Posted August 29, 2013 Posted August 29, 2013 There's an example of using it with dxDrawImage on the wiki of fetchRemote. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Eistee Posted August 29, 2013 Author Posted August 29, 2013 client: function startImageDownload( playerToReceive ) fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false, playerToReceive ) end function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end server: addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function myCallback( responseData ) if fileExists("ice.png") then fileDelete("ice.png") end local file = fileCreate("ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "ice.png", true, TitelHintergrund) end doesnt work.. help pls
Castillo Posted August 29, 2013 Posted August 29, 2013 addEvent ( "onClientGotImage", true ) addEventHandler ( "onClientGotImage", resourceRoot, function ( responseData ) if fileExists("ice.png") then fileDelete("ice.png") end local file = fileCreate("ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "ice.png", true, TitelHintergrund) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Eistee Posted August 29, 2013 Author Posted August 29, 2013 Hm Full script: client: addEventHandler("onClientResourceStart", resourceRoot, function() HintergrundServer = guiCreateStaticImage(-4, 0, 1440, 900, "images/COD/titel.png", false) showCursor (true) ButtonBeitrittzumSpiel = guiCreateButton(0.02, 0.02, 0.15, 0.03, "Dem Spiel beitreten", true, HintergrundServer) guiSetProperty(ButtonBeitrittzumSpiel, "NormalTextColour", "FFAAAAAA") ButtonPrivatesMatch = guiCreateButton(0.02, 0.06, 0.15, 0.03, "Privates Match", true, HintergrundServer) guiSetProperty(ButtonPrivatesMatch, "NormalTextColour", "FFAAAAAA") ButtonKlasseneditor = guiCreateButton(0.02, 0.11, 0.15, 0.03, "Klasseneditor", true, HintergrundServer) guiSetProperty(ButtonKlasseneditor, "NormalTextColour", "FFAAAAAA") ButtonAbschussserien = guiCreateButton(0.02, 0.15, 0.15, 0.03, "Abschussserien", true, HintergrundServer) guiSetProperty(ButtonAbschussserien, "NormalTextColour", "FFAAAAAA") ButtonTitelbearbeitung = guiCreateButton(0.02, 0.19, 0.15, 0.03, "Titelbearbeitung", true, HintergrundServer) guiSetProperty(ButtonTitelbearbeitung, "NormalTextColour", "FFAAAAAA") ButtonFreunde = guiCreateButton(0.02, 0.23, 0.15, 0.03, "Freunde", true, HintergrundServer) guiSetProperty(ButtonFreunde, "NormalTextColour", "FFAAAAAA") ButtonOptionen = guiCreateButton(0.02, 0.27, 0.15, 0.03, "Optionen", true, HintergrundServer) guiSetProperty(ButtonOptionen, "NormalTextColour", "FFAAAAAA") TitelHintergrund = guiCreateStaticImage(0.76, 0.00, 0.24, 0.20, "images/intro/c_black.png", true, HintergrundServer) guiSetAlpha(TitelHintergrund, 0.67) -- img = guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "images/COD/titel.png", true, TitelHintergrund) NameLabelTITEL = guiCreateLabel(0.00, 0.02, 1.00, 0.10, "M4xStrik3r", true, TitelHintergrund) local font_0 = guiCreateFont("images/jersey.ttf") guiSetFont(NameLabelTITEL, font_0) guiLabelSetColor(NameLabelTITEL, 247, 114, 6) guiLabelSetHorizontalAlign(NameLabelTITEL, "center", false) KillsLabel = guiCreateLabel(0.06, 0.75, 0.42, 0.09, "Kills...272", true, TitelHintergrund) guiSetFont(KillsLabel, font_0) TodeLabel = guiCreateLabel(0.06, 0.86, 0.42, 0.09, "Tode...333", true, TitelHintergrund) guiSetFont(TodeLabel, font_0) levelLabel = guiCreateLabel(0.78, 0.81, 0.16, 0.09, "Level...23", true, TitelHintergrund) guiSetFont(levelLabel, font_0) guiLabelSetHorizontalAlign(levelLabel, "right", false) ButtonServerVerlassen = guiCreateButton(0.02, 0.33, 0.15, 0.03, "Server verlassen", true, HintergrundServer) guiSetProperty(ButtonServerVerlassen, "NormalTextColour", "FFAAAAAA") end ) ------------------------ addEvent ( "onClientGotImage", true ) addEventHandler ( "onClientGotImage", resourceRoot, function ( responseData ) if fileExists("ice.png") then fileDelete("ice.png") end local file = fileCreate("ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "ice.png", true, TitelHintergrund) end ) server: function startImageDownload( playerToReceive ) fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false, playerToReceive ) end function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end
Castillo Posted August 29, 2013 Posted August 29, 2013 -- client side: addEventHandler("onClientResourceStart", resourceRoot, function() HintergrundServer = guiCreateStaticImage(-4, 0, 1440, 900, "images/COD/titel.png", false) showCursor (true) ButtonBeitrittzumSpiel = guiCreateButton(0.02, 0.02, 0.15, 0.03, "Dem Spiel beitreten", true, HintergrundServer) guiSetProperty(ButtonBeitrittzumSpiel, "NormalTextColour", "FFAAAAAA") ButtonPrivatesMatch = guiCreateButton(0.02, 0.06, 0.15, 0.03, "Privates Match", true, HintergrundServer) guiSetProperty(ButtonPrivatesMatch, "NormalTextColour", "FFAAAAAA") ButtonKlasseneditor = guiCreateButton(0.02, 0.11, 0.15, 0.03, "Klasseneditor", true, HintergrundServer) guiSetProperty(ButtonKlasseneditor, "NormalTextColour", "FFAAAAAA") ButtonAbschussserien = guiCreateButton(0.02, 0.15, 0.15, 0.03, "Abschussserien", true, HintergrundServer) guiSetProperty(ButtonAbschussserien, "NormalTextColour", "FFAAAAAA") ButtonTitelbearbeitung = guiCreateButton(0.02, 0.19, 0.15, 0.03, "Titelbearbeitung", true, HintergrundServer) guiSetProperty(ButtonTitelbearbeitung, "NormalTextColour", "FFAAAAAA") ButtonFreunde = guiCreateButton(0.02, 0.23, 0.15, 0.03, "Freunde", true, HintergrundServer) guiSetProperty(ButtonFreunde, "NormalTextColour", "FFAAAAAA") ButtonOptionen = guiCreateButton(0.02, 0.27, 0.15, 0.03, "Optionen", true, HintergrundServer) guiSetProperty(ButtonOptionen, "NormalTextColour", "FFAAAAAA") TitelHintergrund = guiCreateStaticImage(0.76, 0.00, 0.24, 0.20, "images/intro/c_black.png", true, HintergrundServer) guiSetAlpha(TitelHintergrund, 0.67) -- img = guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "images/COD/titel.png", true, TitelHintergrund) NameLabelTITEL = guiCreateLabel(0.00, 0.02, 1.00, 0.10, "M4xStrik3r", true, TitelHintergrund) local font_0 = guiCreateFont("images/jersey.ttf") guiSetFont(NameLabelTITEL, font_0) guiLabelSetColor(NameLabelTITEL, 247, 114, 6) guiLabelSetHorizontalAlign(NameLabelTITEL, "center", false) KillsLabel = guiCreateLabel(0.06, 0.75, 0.42, 0.09, "Kills...272", true, TitelHintergrund) guiSetFont(KillsLabel, font_0) TodeLabel = guiCreateLabel(0.06, 0.86, 0.42, 0.09, "Tode...333", true, TitelHintergrund) guiSetFont(TodeLabel, font_0) levelLabel = guiCreateLabel(0.78, 0.81, 0.16, 0.09, "Level...23", true, TitelHintergrund) guiSetFont(levelLabel, font_0) guiLabelSetHorizontalAlign(levelLabel, "right", false) ButtonServerVerlassen = guiCreateButton(0.02, 0.33, 0.15, 0.03, "Server verlassen", true, HintergrundServer) guiSetProperty(ButtonServerVerlassen, "NormalTextColour", "FFAAAAAA") triggerServerEvent ( "requestImage", localPlayer ) end ) ------------------------ addEvent ( "onClientGotImage", true ) addEventHandler ( "onClientGotImage", resourceRoot, function ( responseData ) if fileExists("ice.png") then fileDelete("ice.png") end local file = fileCreate("ice.png") fileWrite(file, responseData) fileClose(file) guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "ice.png", true, TitelHintergrund) end ) -- server side: function startImageDownload( ) fetchRemote ( "http://www.xn--fischspezialitten-knobloch-thc.de/wp-content/uploads/2010/05/ice.png", myCallback, "", false, source ) end addEvent ( "requestImage", true ) addEventHandler ( "requestImage", root, startImageDownload ) function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Eistee Posted August 29, 2013 Author Posted August 29, 2013 Doesnt work.. Logs: WARNING: cod\start_s.lua:12: cod\start_s.lua:12: Couldn't packetize argument list. Invalid string specified, limit is 65535 characters. To use longer strings, set script to 1.3.0-9.03772 or higher.
EstrategiaGTA Posted August 29, 2013 Posted August 29, 2013 There isn't line 12 in the server side...
Castillo Posted August 29, 2013 Posted August 29, 2013 What is your server version? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Eistee Posted August 29, 2013 Author Posted August 29, 2013 oh it works with the newest version! thank you so much!!!!
Castillo Posted August 29, 2013 Posted August 29, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Eistee Posted August 30, 2013 Author Posted August 30, 2013 How i can check the function every 1 second?
Eistee Posted August 30, 2013 Author Posted August 30, 2013 How i insert this here? : addEvent ( "onClientGotImage", true ) addEventHandler ( "onClientGotImage", resourceRoot, function ( responseData ) if fileExists("preview.jpg") then fileDelete("preview.jpg") end local file = fileCreate("preview.jpg") fileWrite(file, responseData) fileClose(file) destroyElement ( titelanzeige ) titelanzeige = guiCreateStaticImage(0.06, 0.18, 0.88, 0.46, "preview.jpg", true, TitelHintergrund) end )
Castillo Posted August 30, 2013 Posted August 30, 2013 I don't understand what do you mean. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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