Jump to content

What the hell ?


FuriouZ

Recommended Posts

Hey

I have one very stupit problem.. i'm getting so sick to fix it, i tryed like 3hours to fix price of this shit, but still nothing ..

--PICTURES

mta-screen_2013-10-05_00-19-02.png

mta-screen_2013-10-05_00-19-05.png

mta-screen_2013-10-05_00-19-07.png

function drawWorldGui() 
        GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) 
        showCursor(true) 
  
        --'FREEROAM' 
        GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamEnter.png", true, GUIEditor.staticimage[1]) --(picture 2)  
        --'Selected' 
        GUIEditor.staticimage[3] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3)        
        guiSetVisible(GUIEditor.staticimage[3], false)           
         
        GUIEditor.button[1] = guiCreateButton(0.105, 0.335, 0.20, 0.28, "", true, GUIEditor.staticimage[1]) 
                              guiSetProperty(GUIEditor.button[1], "AlwaysOnTop", "True")                               
                              guiSetAlpha(GUIEditor.button[1], 0.5)                                
                              addEventHandler( "onClientMouseEnter",GUIEditor.button[1], FreeroamEnter) 
                              addEventHandler("onClientMouseLeave",GUIEditor.button[1],FreeroamLeave)   
    end 
addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) 
  
function FreeroamEnter () 
   guiSetVisible(GUIEditor.staticimage[3], true);    
   guiSetVisible(GUIEditor.staticimage[2], false);    
end 
function FreeroamLeave () 
   guiSetVisible(GUIEditor.staticimage[2], true);    
   guiSetVisible(GUIEditor.staticimage[3], false);    
end 

If my cursor is on button, then should appear image with freeroam tag (pic 2) , but if i go to the button, then image dissapears.. fucking shit .. hope you understand

Link to comment
  • Moderators

I would proceed like this:

function drawWorldGui() 
    GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) 
    showCursor(true) 
     
    --'Normal state' 
    GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3)       
    addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) 
    addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) 
end 
addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) 
  
function FreeroamEnter () 
    guiStaticImageLoadImage( , "img/thumbs/FreeroamEnter.png" ) --'Hover state' 
end 
  
function FreeroamLeave () 
    guiStaticImageLoadImage( , "img/thumbs/FreeroamLeave.png" ) --'Normal state' 
end 

So I only use 1 static image and then I just change the image displayed in that static image with guiStaticImageLoadImage.

and I can add the two events ("onClientMouseEnter" and "onClientMouseLeave") on the correct element (which is the GUIEditor.staticimage[2])

(you added those events on the button you created and that is not needed at all)

Should work but you still need to do the click detection but I guess you will do it well.

Best regards,

Citizen

Edited by Guest
Link to comment

Doesn't work, says line 13 & 17 have unexpected symbol near ","

function drawWorldGui() 
    GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) 
    showCursor(true) 
    
    --'Normal state' 
    GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3)       
    addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) 
    addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) 
end 
addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) 
  
function FreeroamEnter () 
    guiStaticImageLoadImage( , "img/thumbs/FreeroamEnter.png" ) --'Hover state' 
end 
  
function FreeroamLeave () 
    guiStaticImageLoadImage( , "img/thumbs/FreeroamLeave.png" ) --'Normal state' 
end 

Link to comment
function drawWorldGui() 
    GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) 
    showCursor(true) 
    
    --'Normal state' 
    GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3)       
    addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) 
    addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) 
end 
addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) 
  
function FreeroamEnter () 
    guiStaticImageLoadImage( source, "img/thumbs/FreeroamEnter.png" ) --'Hover state' 
end 
  
function FreeroamLeave () 
    guiStaticImageLoadImage( source, "img/thumbs/FreeroamLeave.png" ) --'Normal state' 
end 

Link to comment
function drawWorldGui() 
    GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) 
    showCursor(true) 
    
    --'Normal state' 
    GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3)       
    addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) 
    addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) 
end 
addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) 
  
function FreeroamEnter () 
    guiStaticImageLoadImage( source, "img/thumbs/FreeroamEnter.png" ) --'Hover state' 
end 
  
function FreeroamLeave () 
    guiStaticImageLoadImage( source, "img/thumbs/FreeroamLeave.png" ) --'Normal state' 
end 

It can't be "source" .. It happens .. :/

mta-screen_2013-10-05_11-37-12.png

mta-screen_2013-10-05_11-37-13.png

Link to comment
function drawWorldGui() 
    GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) 
    showCursor(true) 
    
    --'Normal state' 
    GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3)       
    addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) 
    addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) 
end 
addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) 
  
function FreeroamEnter () 
    guiStaticImageLoadImage( source, "img/thumbs/FreeroamEnter.png" ) --'Hover state' 
end 
  
function FreeroamLeave () 
    guiStaticImageLoadImage( source, "img/thumbs/FreeroamLeave.png" ) --'Normal state' 
end 

It can't be "source" .. It happens .. :/

mta-screen_2013-10-05_11-37-12.png

mta-screen_2013-10-05_11-37-13.png

No you can make it source . Read this part from the wiki : The source of this event is the GUI element that was pointed at.

Good Luck!

Link to comment
  • Moderators

Oh yeah sorry my bad, I forgot to finish that part, so yeah Mr.Pres[T]ege finished my work by adding source for the 1st argument but it also could be GUIEditor.staticimage[2] like this:

function FreeroamEnter () 
    guiStaticImageLoadImage( GUIEditor.staticimage[2], "img/thumbs/FreeroamEnter.png" ) --'Hover state' 
end 
  
function FreeroamLeave () 
    guiStaticImageLoadImage( GUIEditor.staticimage[2], "img/thumbs/FreeroamLeave.png" ) --'Normal state' 
end 

That's exactly the same because GUIEditor.staticimage[2] will always be the source of this event.

For the baground problem, just set the property "AlwaysOnTop" for the staticimage[2]:

guiSetProperty( GUIEditor.staticimage[2], "AlwaysOnTop" ) 

That should do the trick.

Sorry again for that mistake.

Best regards,

Citizen

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...