Jump to content

Flying image


Recommended Posts

function showClientImage()
 
k1=guiCreateStaticImage( 0, 544, 500, 100, "winner.png", false )
end
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage )
 
move1_1 ()
end
addEventHandler ( "onResourceStart", getRootElement(), recourse_says_hai )
 
function move1_1 ()
moveObject ( k1, 5000, 780, 544,  )
setTimer ( move1_2, 5000, 1 )
end

i want that the image fly from right to left why it dont work

Link to comment

I hope i can :mrgreen:

You should use DirectX Pictures because its difficult moving GUI Images.

This example should work.

And btw. you should work with guiSetPosition instead of setElementPosition

/movepic

local k1= {}
k1["xPos"] = 0  -- Startposition of the Picture
k1["EventAdded"] = 0
k1["Picspeed"] = 1 -- The Speed of the Moving Picture
k1["Picture"] = "winner.png" -- Filename
k1["screenWidth"], k1["screenHeight"] = guiGetScreenSize()
 
function moveClientImage(filename)
if k1["EventAdded"] == 0 then
addEventHandler ( "onClientRender", getRootElement(), moveClientImage )
         k1["EventAdded"] = 1
end
    k1["xPos"] = k1["xPos"] + k1["Picspeed"]
    k1["image"] = dxDrawImage( k1["xPos"], 544, 500, 100, filename )
if  k1["xPos"] > k1["screenWidth"] then
         k1["xPos"] = 0
         k1["EventAdded"] = 0
removeEventHandler ( "onClientRender", getRootElement(), moveClientImage )
end
end
 
function cmdMoveClientImage(cmd, speed)
if speed then
if tonumber(speed) > 0 then
                k1["Picspeed"] = tonumber(speed)
else
return outputChatBox("Please use a Speed over 0. Syntax: /movepic ")
end
end
outputChatBox("Moving Picture '"..k1["Picture"].."' with "..speed.."/Frame per Second !")
    moveClientImage(k1["Picture"])
end
addCommandHandler("movepic", cmdMoveClientImage)

edit a billboard with youre image and everything will be ok : )

kevin11 stop talking bull sh it you f*cking nolifer

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...