S3Nn4oXx Posted September 9, 2015 Share Posted September 9, 2015 Someone knows a script that when i type /command then the image appears Thanks for your Attention Link to comment
HUNGRY:3 Posted September 9, 2015 Share Posted September 9, 2015 (edited) function wot() guiSetVisible(image,true) -- ONLY IF GUI IMAGE! end addCommandHandler("appear",wot) Edited September 9, 2015 by Guest Link to comment
S3Nn4oXx Posted September 9, 2015 Author Share Posted September 9, 2015 EDIT:I mean, when I type the command to the image appears then it disappeared with an animation Link to comment
-ffn-python Posted September 10, 2015 Share Posted September 10, 2015 interpolateBetween , setTimer Link to comment
S3Nn4oXx Posted September 11, 2015 Author Share Posted September 11, 2015 Can you show me example? Link to comment
JR10 Posted September 11, 2015 Share Posted September 11, 2015 There are already 3 examples on the wiki page. Link to comment
S3Nn4oXx Posted September 12, 2015 Author Share Posted September 12, 2015 There are already 3 examples on the wiki page. I want example 2 local g_Window = nil addCommandHandler("window", function () if g_Window then return end g_Window = {} local screenWidth, screenHeight = guiGetScreenSize() g_Window.windowWidth, g_Window.windowHeight = 400, 315 local left = screenWidth/2 - g_Window.windowWidth/2 local top = screenHeight/2 - g_Window.windowHeight/2 g_Window.window = guiCreateWindow(left, top, g_Window.windowWidth, g_Window.windowHeight, "Interpolation on GUI", false) g_Window.closeBtn = guiCreateButton(320, 285, 75, 23, "Close", false, g_Window.window) guiWindowSetSizable(g_Window.window, false) guiWindowSetMovable(g_Window.window, false) guiSetEnabled(g_Window.window, false) guiSetVisible(g_Window.window, false) g_Window.startTime = getTickCount() g_Window.startSize = {0, 0} g_Window.endSize = {g_Window.windowWidth, g_Window.windowHeight} g_Window.endTime = g_Window.startTime + 1000 addEventHandler("onClientRender", getRootElement(), popWindowUp) end) function on_closeBtn_clicked(button, state, absoluteX, absoluteY) if (button ~= "left") or (state ~= "up") then return end if not g_Window then return end showCursor(false) guiSetEnabled(g_Window.window, false) guiWindowSetMovable(g_Window.window, false) local screenWidth, screenHeight = guiGetScreenSize() local posX, posY = guiGetPosition(g_Window.window, false) g_Window.startTime = getTickCount() g_Window.startSize = {g_Window.windowWidth, g_Window.windowHeight} g_Window.startCenter = { posX + g_Window.windowWidth/2, posY + g_Window.windowHeight/2, } g_Window.endSize = {0, 0} g_Window.endTime = g_Window.startTime + 1000 g_Window.endCenter = { screenWidth, screenHeight } addEventHandler("onClientRender", getRootElement(), popWindowDown) end function popWindowUp() local now = getTickCount() local elapsedTime = now - g_Window.startTime local duration = g_Window.endTime - g_Window.startTime local progress = elapsedTime / duration local width, height, _ = interpolateBetween ( g_Window.startSize[1], g_Window.startSize[2], 0, g_Window.endSize[1], g_Window.endSize[2], 0, progress, "OutElastic") guiSetSize(g_Window.window, width, height, false) local screenWidth, screenHeight = guiGetScreenSize() guiSetPosition(g_Window.window, screenWidth/2 - width/2, screenHeight/2 - height/2, false) if not guiGetVisible(g_Window.window) then guiSetVisible(g_Window.window, true) guiBringToFront(g_Window.window) end if now >= g_Window.endTime then guiSetEnabled(g_Window.window, true) guiBringToFront(g_Window.window) removeEventHandler("onClientRender", getRootElement(), popWindowUp) addEventHandler("onClientGUIClick", g_Window.closeBtn, on_closeBtn_clicked, false) showCursor(true) guiWindowSetMovable(g_Window.window, true) end end function popWindowDown() local now = getTickCount() local elapsedTime = now - g_Window.startTime local duration = g_Window.endTime - g_Window.startTime local progress = elapsedTime / duration local width, height, _ = interpolateBetween ( g_Window.startSize[1], g_Window.startSize[2], 0, g_Window.endSize[1], g_Window.endSize[2], 0, progress, "InQuad") guiSetSize(g_Window.window, width, height, false) local centerX, centerY, _ = interpolateBetween ( g_Window.startCenter[1], g_Window.startCenter[2], 0, g_Window.endCenter[1], g_Window.endCenter[2], 0, progress, "InQuad") guiSetPosition(g_Window.window, centerX - width/2, centerY - height/2, false) if now >= g_Window.endTime then removeEventHandler("onClientRender", getRootElement(), popWindowDown) destroyElement(g_Window.window) g_Window = nil end end ' How i can replace it from gui to dxDrawRectangle ? Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 local a = 0 function() a = a + 2 valueX = 0 valueY = 0 animation = guiCreateStaticImage (valueX, valueY, 0"youFolder/image.png",tostring(a), false) end end ) Link to comment
xeon17 Posted September 13, 2015 Share Posted September 13, 2015 local a = 0 function() a = a + 2 valueX = 0 valueY = 0 animation = guiCreateStaticImage (valueX, valueY, 0"youFolder/image.png",tostring(a), false) end end ) Please stop Link to comment
S3Nn4oXx Posted September 13, 2015 Author Share Posted September 13, 2015 local a = 0 function() a = a + 2 valueX = 0 valueY = 0 animation = guiCreateStaticImage (valueX, valueY, 0"youFolder/image.png",tostring(a), false) end end ) Debugscript says expected near '(' at like 3 Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 Okay. Just Change it local a = 0 addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("AnimationTest", getLocalPlayer()) end ) addEvent("AnimationImage", true) addEventHandler("AnimationImage",root, function() a = a + 2 animation = guiCreateStaticImage (0, 0, 0"youFolder/image.png",tostring(a), false) end ) Server-side addEvent("AnimationTest", true) addEventHandler("AnimationTest", root, function() triggerClientEvent( client,"AnimationImage", client) end ) Link to comment
S3Nn4oXx Posted September 13, 2015 Author Share Posted September 13, 2015 (edited) Okay. Just Change it local a = 0 addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("AnimationTest", getLocalPlayer()) end ) addEvent("AnimationImage", true) addEventHandler("AnimationImage",root, function() a = a + 2 animation = guiCreateStaticImage (0, 0, 0"youFolder/image.png",tostring(a), false) end ) Server-side addEvent("AnimationTest", true) addEventHandler("AnimationTest", root, function() triggerClientEvent( client,"AnimationImage", client) end ) Thanks, problem solved Edited September 13, 2015 by Guest Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 Okay. you Add img.png in meta.xml ? Link to comment
S3Nn4oXx Posted September 13, 2015 Author Share Posted September 13, 2015 Okay. you Add img.png in meta.xml ? yes Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 Thanks, problem solved You'r Welcome. Link to comment
xeon17 Posted September 13, 2015 Share Posted September 13, 2015 Okay. Just Change it local a = 0 addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("AnimationTest", getLocalPlayer()) end ) addEvent("AnimationImage", true) addEventHandler("AnimationImage",root, function() a = a + 2 animation = guiCreateStaticImage (0, 0, 0"youFolder/image.png",tostring(a), false) end ) Server-side addEvent("AnimationTest", true) addEventHandler("AnimationTest", root, function() triggerClientEvent( client,"AnimationImage", client) end ) Can you tell me, why you're using a trigger to show the image? Also, you forget the height argument at line 11. And argument 6 need to be a boolean. Your code doesn't make sense. Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 That's My Style Link to comment
xeon17 Posted September 13, 2015 Share Posted September 13, 2015 Your code doesn't even work. What are you talking about? Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 That's The Problem? Event Creation. please local a = 0 addEventHandler("onClientResourceStart", resourceRoot, function() a = a + 2 animation = guiCreateStaticImage (0, 0, 0"youFolder/image.png",tostring(a), false) end ) Link to comment
RenanPG Posted September 13, 2015 Share Posted September 13, 2015 That's The Problem? Event Creation. please local a = 0 addEventHandler("onClientResourceStart", resourceRoot, function() a = a + 2 animation = guiCreateStaticImage (0, 0, 0"youFolder/image.png",tostring(a), false) end ) The main problem is not your "coding style", at least you should pass the arguments correctly. Link to comment
xeon17 Posted September 13, 2015 Share Posted September 13, 2015 (edited) That's The Problem? Event Creation. please local a = 0 addEventHandler("onClientResourceStart", resourceRoot, function() a = a + 2 animation = guiCreateStaticImage (0, 0, 0"youFolder/image.png",tostring(a), false) end ) 1. There need to be a comma after 0 (argument 3 of guiCreateStaticImage) 2. Argument 4 (height) is missing. 3. Argument 6 (5 in your code) have to be a boolean and not a number. 4. Your code will onlly create a image on the whole screen, without any animation (what S3Nn4oXx wanted if i understood him well) Edited September 13, 2015 by Guest Link to comment
-ffn-python Posted September 13, 2015 Share Posted September 13, 2015 Okay. Thank you for the information 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