Jump to content

Table ._.


iPrestege

Recommended Posts

Posted

local Buttons = { Button[1],Button[2],Button[3],Button[4],Button[5] } 
addEventHandler("onClientMouseEnter",guiRoot, 
            function ( ) 
                for _,k in ipairs ( Buttons ) do 
                    if ( source == k ) then 
                        playSoundFrontEnd(3); 
                    end 
                end 
            end 
        ); 

Hi guys i have problem with this table ._. will no error's and not work i try to string the buttons but not work to ._. what do you think the problem?

Posted

You can try this:

  
addEventHandler("onClientMouseEnter",guiRoot, 
            function ( ) 
                for i=1, 5 do 
                    if ( source == Button[i] ) then 
                        playSoundFrontEnd(3); 
                        if not i == 5 then break end 
                    end 
                end 
            end 
        ); 

Posted
You can try this:

  
addEventHandler("onClientMouseEnter",guiRoot, 
            function ( ) 
                for i=1, 5 do 
                    if ( source == Button[i] ) then 
                        playSoundFrontEnd(3); 
                        if not i == 5 then break end 
                    end 
                end 
            end 
        ); 

This also does not work ._.

Posted

Enjoy.

local Buttons = { [Button[1]] = true, [Button[2]] = true, [Button[3]] = true, [Button[4]] = true, [Button[5]] = true } 
addEventHandler("onClientMouseEnter",guiRoot, 
    function ( ) 
        if Buttons[source] then 
            playSoundFrontEnd(3) 
        end 
    end 
) 

Posted
Enjoy.

local Buttons = { [Button[1]] = true, [Button[2]] = true, [Button[3]] = true, [Button[4]] = true, [Button[5]] = true } 
addEventHandler("onClientMouseEnter",guiRoot, 
    function ( ) 
        if Buttons[source] then 
            playSoundFrontEnd(3) 
        end 
    end 
) 

not work too ._.

Posted
So I think it's an MTA bug.

No!That's not true >!< when i do it like that :

addEventHandler("onClientMouseEnter",Button, 
    function ( ) 
        playSoundFrontEnd(3); 
end,false); 

Work's fine !

Posted
local Buttons = {[Button[1]] = true, [Button[2]] = true, [Button[3]] = true, [Button[4]] = true, [Button[5]] = true } 
addEventHandler("onClientMouseEnter",guiRoot, 
    function ( ) 
        if Buttons[source] then 
            playSoundFrontEnd(3) 
        end 
    end 
) 

EDITTED ^^

My code i sent you ^^ is working. Make sure that the buttons are created before the Buttons table, also make sure that there is a GUI parent element.

Posted
local Buttons = {[Button[1]] = true, [Button[2]] = true, [Button[3]] = true, [Button[4]] = true, [Button[5]] = true } 
addEventHandler("onClientMouseEnter",guiRoot, 
    function ( ) 
        if Buttons[source] then 
            playSoundFrontEnd(3) 
        end 
    end 
) 

EDITTED ^^

My code i sent you ^^ is working. Make sure that the buttons are created before the Buttons table, also make sure that there is a GUI parent element.

Still the same error !

  • Moderators
Posted

Your table is a little bit strange? is "Button" also a table?

local Buttons = { Button[1],Button[2],Button[3],Button[4],Button[5] } 

  
for i=1, 5,1 do  Buttons[i]= Button[i]  end 
  

Posted
Your table is a little bit strange? is "Button" also a table?

local Buttons = { Button[1],Button[2],Button[3],Button[4],Button[5] } 

  
for i=1, 5,1 do  Buttons[i]= Button[i]  end 
  

._. Yes the buttons table.

Posted

Ok,See now what's the problem with this fuck function?

  
GameSystem.button = {} 
GameSystem.button[1] = guiCreateButton(14, 355, 147, 27, "......", false, GameSystem.window[1]) 
GameSystem.button[2] = guiCreateButton(233, 357, 147, 27, ".....", false, GameSystem.window[1]) 
   
addEventHandler("onClientMouseEnter",root, 
    function ( ) 
        if ( source == GameSystem.button[1] or source == GameSystem.button[2] ) then 
            playSoundFrontEnd(4) 
                end 
            end 
    ) 

i changed the "Variables" and does not work too .

Posted
Ok,See now what's the problem with this :o function?

  
GameSystem.button = {} 
GameSystem.button[1] = guiCreateButton(14, 355, 147, 27, "......", false, GameSystem.window[1]) 
GameSystem.button[2] = guiCreateButton(233, 357, 147, 27, ".....", false, GameSystem.window[1]) 
   
addEventHandler("onClientMouseEnter",root, 
    function ( ) 
        if ( source == GameSystem.button[1] or source == GameSystem.button[2] ) then 
            playSoundFrontEnd(4) 
                end 
            end 
    ) 

i changed the "Variables" and does not work too .

Try this;

local GameSystem.button = { 
    guiCreateButton(14, 355, 147, 27, "......", false, GameSystem.window[1]), 
    guiCreateButton(233, 357, 147, 27, ".....", false, GameSystem.window[1]) 
} 
  
addEventHandler("onClientMouseEnter", guiRoot, 
    function() 
        for i = 1, #GameSystem.button do 
            if(source == GameSystem.button[i])then 
                playSoundFrontEnd(4) 
                break 
            end 
        end 
    end 
) 

Posted
Ok,See now what's the problem with this :o function?

  
GameSystem.button = {} 
GameSystem.button[1] = guiCreateButton(14, 355, 147, 27, "......", false, GameSystem.window[1]) 
GameSystem.button[2] = guiCreateButton(233, 357, 147, 27, ".....", false, GameSystem.window[1]) 
   
addEventHandler("onClientMouseEnter",root, 
    function ( ) 
        if ( source == GameSystem.button[1] or source == GameSystem.button[2] ) then 
            playSoundFrontEnd(4) 
                end 
            end 
    ) 

i changed the "Variables" and does not work too .

Try this;

local GameSystem.button = { 
    guiCreateButton(14, 355, 147, 27, "......", false, GameSystem.window[1]), 
    guiCreateButton(233, 357, 147, 27, ".....", false, GameSystem.window[1]) 
} 
  
addEventHandler("onClientMouseEnter", guiRoot, 
    function() 
        for i = 1, #GameSystem.button do 
            if(source == GameSystem.button[i])then 
                playSoundFrontEnd(4) 
                break 
            end 
        end 
    end 
) 

Thank's,Tete work's .

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