Jump to content

Table ._.


iPrestege

Recommended Posts

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?

Link to comment
  • Moderators

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 
        ); 

Link to comment
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 ._.

Link to comment
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 ._.

Link to comment
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.

Link to comment
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 !

Link to comment

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 .

Link to comment
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 
) 

Link to comment
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 .

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