Jump to content

Button doesn't work, but why?


papam77

Recommended Posts

function lobby () 
showCursor ( true ) 
local bg =  
{ 
["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/bg.png", true) 
} 
guiSetEnabled (bg["bg"], false ) 
local ikony = 
    { 
    ["dd"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/dd.png", true), -- Obdélník 
    ["drift"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/drift.png", true), -- Čtverec 
    ["parkour"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/parkour.png", true), -- Čtverec 
    ["trials"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/trials.png", true), -- Čtverec 
    ["shooter"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/shooter.png", true), -- Čtverec 
    ["dm"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/dm.png", true), -- Obdélník         
    ["hunter"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/hunter.png", true), -- Obdélník 
    ["zombie"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/zombie.png", true), -- Obdélník 
    ["slender"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/slender.png", true), -- Obdélník 
    ["race"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/race.png", true), -- Obdélník 
    ["counterstrike"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/counterstrike.png", true), -- Obdélník 
    } 
     
    local labely = { 
["hraci"] = guiCreateLabel(0.00, 0.85, 1.00, 0.14, "Players: ".. tostring( #getElementsByType( "player" ) ), true) 
 } 
 font2 = guiCreateFont( "lithos.ttf", 50 ) 
 guiSetFont( labely["hraci"], font2 ) 
 guiLabelSetHorizontalAlign(labely["hraci"], "center", false) 
 guiLabelSetVerticalAlign(labely["hraci"], "center") 
     
     
    guiSetAlpha (ikony["dd"], 0.75 ) 
    guiSetAlpha (ikony["drift"], 0.75 ) 
    guiSetAlpha (ikony["parkour"], 0.75 ) 
    guiSetAlpha (ikony["trials"], 0.75 ) 
    guiSetAlpha (ikony["shooter"], 0.75 ) 
    guiSetAlpha (ikony["dm"], 0.75 ) 
    guiSetAlpha (ikony["hunter"], 0.75 ) 
    guiSetAlpha (ikony["zombie"], 0.75 ) 
    guiSetAlpha (ikony["slender"], 0.75 ) 
    guiSetAlpha (ikony["race"], 0.75 ) 
    guiSetAlpha (ikony["counterstrike"], 0.75 ) 
     
    addEventHandler ( "onClientMouseEnter", root, 
    function ( aX, aY ) 
        for _, gui in pairs ( ikony ) do 
            if ( gui == source ) then 
                guiSetAlpha ( source, 1 ) 
                break 
            end 
        end 
    end 
) 
  
addEventHandler ( "onClientMouseLeave", root, 
    function ( aX, aY ) 
        for _, gui in pairs ( ikony ) do 
            if ( gui == source ) then 
                guiSetAlpha ( source, 0.75 ) 
                break 
            end 
        end 
    end 
) 
end      
addCommandHandler ("lobby", lobby ) 
  
function zpet () 
  addEventHandler ( "onClientGUIClick", ikony["dm"], zpet2, false ) 
    end 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), zpet ) 
    
    function zpet2(button) 
    if button == "left" then 
    showCursor ( false ) 
    outputConsole ("work it") 
    end 
     end 
  
  
     

Why button doesn't work?

ERROR: lobby/client.lua:69:attempt to index global 'ikony' (a nil value)

Link to comment

For the resource topic:

Anything outside the function's are created automatically without anything to trigger it, and by not putting it inside a function then it's global for the rest of the script to use.

The event "onClientResourceStart" is triggered after the resource is downloaded to the client, while anything outside of it and is global will be shown/created while the resource is being downloaded to the client.

local bg = { 
    ["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/bg.png", true) 
} 
guiSetEnabled (bg["bg"], false ) 
local ikony = { 
    ["dd"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/dd.png", true), -- Obdélník 
    ["drift"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/drift.png", true), -- Čtverec 
    ["parkour"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/parkour.png", true), -- Čtverec 
    ["trials"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/trials.png", true), -- Čtverec 
    ["shooter"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/shooter.png", true), -- Čtverec 
    ["dm"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/dm.png", true), -- Obdélník         
    ["hunter"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/hunter.png", true), -- Obdélník 
    ["zombie"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/zombie.png", true), -- Obdélník 
    ["slender"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/slender.png", true), -- Obdélník 
    ["race"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/race.png", true), -- Obdélník 
    ["counterstrike"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/counterstrike.png", true), -- Obdélník 
} 
for _,image in pairs(ikony)do 
    guiSetAlpha(image,0.75) 
end 
    
local labely = { 
    ["hraci"] = guiCreateLabel(0.00, 0.85, 1.00, 0.14, "Players: ".. tostring( #getElementsByType( "player" ) ), true) 
} 
local font2 = guiCreateFont( "lithos.ttf", 50 ) 
guiSetFont( labely["hraci"], font2 ) 
guiLabelSetHorizontalAlign(labely["hraci"], "center", false) 
guiLabelSetVerticalAlign(labely["hraci"], "center") 
  
--[[guiSetAlpha (ikony["dd"], 0.75 ) 
guiSetAlpha (ikony["drift"], 0.75 ) 
guiSetAlpha (ikony["parkour"], 0.75 ) 
guiSetAlpha (ikony["trials"], 0.75 ) 
guiSetAlpha (ikony["shooter"], 0.75 ) 
guiSetAlpha (ikony["dm"], 0.75 ) 
guiSetAlpha (ikony["hunter"], 0.75 ) 
guiSetAlpha (ikony["zombie"], 0.75 ) 
guiSetAlpha (ikony["slender"], 0.75 ) 
guiSetAlpha (ikony["race"], 0.75 ) 
guiSetAlpha (ikony["counterstrike"], 0.75 )]] 
  
addEventHandler ( "onClientMouseEnter", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 1 ) 
            break 
        end 
    end 
end) 
addEventHandler ( "onClientMouseLeave", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 0.75 ) 
            break 
        end 
    end 
end) 
  
local visible = false 
  
bindKey ("F1", "down",function() 
    visible =  not visible 
    showCursor ( visible ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, visible ) 
    end 
end) 
  
  
addEventHandler ( "onClientGUIClick", ikony["dm"], function(button) 
    if button ~= "left" then return end 
    showCursor ( false ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, not visible ) 
    end 
end, false ) 

Link to comment

ok, try this then:

local bg = { 
    ["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/bg.png", true) 
} 
for _,gui in pairs(bg)do 
    guiSetVisible(gui,false) 
end 
guiSetEnabled (bg["bg"], false ) 
local ikony = { 
    ["dd"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/dd.png", true), -- Obdélník 
    ["drift"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/drift.png", true), -- Čtverec 
    ["parkour"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/parkour.png", true), -- Čtverec 
    ["trials"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/trials.png", true), -- Čtverec 
    ["shooter"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/shooter.png", true), -- Čtverec 
    ["dm"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/dm.png", true), -- Obdélník         
    ["hunter"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/hunter.png", true), -- Obdélník 
    ["zombie"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/zombie.png", true), -- Obdélník 
    ["slender"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/slender.png", true), -- Obdélník 
    ["race"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/race.png", true), -- Obdélník 
    ["counterstrike"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/counterstrike.png", true), -- Obdélník 
} 
for _,image in pairs(ikony)do 
    guiSetAlpha(image,0.75) 
end 
for _,gui in pairs(ikony)do 
    guiSetVisible(gui,false) 
end 
    
local labely = { 
    ["hraci"] = guiCreateLabel(0.00, 0.85, 1.00, 0.14, "Players: ".. tostring( #getElementsByType( "player" ) ), true) 
} 
local font2 = guiCreateFont( "lithos.ttf", 50 ) 
guiSetFont( labely["hraci"], font2 ) 
guiLabelSetHorizontalAlign(labely["hraci"], "center", false) 
guiLabelSetVerticalAlign(labely["hraci"], "center") 
for _,gui in pairs(labely)do 
    guiSetVisible(gui,false) 
end 
  
--[[guiSetAlpha (ikony["dd"], 0.75 ) 
guiSetAlpha (ikony["drift"], 0.75 ) 
guiSetAlpha (ikony["parkour"], 0.75 ) 
guiSetAlpha (ikony["trials"], 0.75 ) 
guiSetAlpha (ikony["shooter"], 0.75 ) 
guiSetAlpha (ikony["dm"], 0.75 ) 
guiSetAlpha (ikony["hunter"], 0.75 ) 
guiSetAlpha (ikony["zombie"], 0.75 ) 
guiSetAlpha (ikony["slender"], 0.75 ) 
guiSetAlpha (ikony["race"], 0.75 ) 
guiSetAlpha (ikony["counterstrike"], 0.75 )]] 
  
addEventHandler ( "onClientMouseEnter", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 1 ) 
            break 
        end 
    end 
end) 
addEventHandler ( "onClientMouseLeave", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 0.75 ) 
            break 
        end 
    end 
end) 
  
local visible = false 
  
bindKey ("F1", "down",function() 
    visible =  not visible 
    showCursor ( visible ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, visible ) 
    end 
end) 
  
  
addEventHandler ( "onClientGUIClick", ikony["dm"], function(button) 
    if button ~= "left" then return end 
    showCursor ( false ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, not visible ) 
    end 
end, false ) 

Next time just use guiSetVisible if you don't want it to be shown to the player.

Link to comment

I made this:

client:

local bg = { 
    ["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/bg.png", true) 
} 
for _,gui in pairs(bg)do 
    guiSetVisible(gui,false) 
end 
guiSetEnabled (bg["bg"], false ) 
local ikony = { 
    ["dd"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/dd.png", true), -- Obdélník 
    ["drift"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/drift.png", true), -- Čtverec 
    ["parkour"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/parkour.png", true), -- Čtverec 
    ["trials"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/trials.png", true), -- Čtverec 
    ["shooter"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/shooter.png", true), -- Čtverec 
    ["dm"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/dm.png", true), -- Obdélník         
    ["hunter"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/hunter.png", true), -- Obdélník 
    ["zombie"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/zombie.png", true), -- Obdélník 
    ["slender"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/slender.png", true), -- Obdélník 
    ["race"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/race.png", true), -- Obdélník 
    ["counterstrike"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/counterstrike.png", true), -- Obdélník 
} 
for _,image in pairs(ikony)do 
    guiSetAlpha(image,0.75) 
end 
for _,gui in pairs(ikony)do 
    guiSetVisible(gui,false) 
end 
    
local labely = { 
    ["hraci"] = guiCreateLabel(0.00, 0.85, 1.00, 0.14, "Players: ".. tostring( #getElementsByType( "player" ) ), true) 
} 
local font2 = guiCreateFont( "lithos.ttf", 50 ) 
guiSetFont( labely["hraci"], font2 ) 
guiLabelSetHorizontalAlign(labely["hraci"], "center", false) 
guiLabelSetVerticalAlign(labely["hraci"], "center") 
for _,gui in pairs(labely)do 
    guiSetVisible(gui,false) 
end 
  
--[[guiSetAlpha (ikony["dd"], 0.75 ) 
guiSetAlpha (ikony["drift"], 0.75 ) 
guiSetAlpha (ikony["parkour"], 0.75 ) 
guiSetAlpha (ikony["trials"], 0.75 ) 
guiSetAlpha (ikony["shooter"], 0.75 ) 
guiSetAlpha (ikony["dm"], 0.75 ) 
guiSetAlpha (ikony["hunter"], 0.75 ) 
guiSetAlpha (ikony["zombie"], 0.75 ) 
guiSetAlpha (ikony["slender"], 0.75 ) 
guiSetAlpha (ikony["race"], 0.75 ) 
guiSetAlpha (ikony["counterstrike"], 0.75 )]] 
  
addEventHandler ( "onClientMouseEnter", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 1 ) 
            break 
        end 
    end 
end) 
addEventHandler ( "onClientMouseLeave", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 0.75 ) 
            break 
        end 
    end 
end) 
  
  
  
local visible = false 
 addEvent( "lobby", true, 
 addEventHandler( "lobby", getRootElement(), lobby, 
bindKey ("F1", "down",function() 
    visible =  not visible 
    showCursor ( visible ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, visible ) 
    end 
    end))) 
  
  
addEventHandler ( "onClientGUIClick", ikony["dm"], function(button) 
    if button ~= "left" then return end 
    showCursor ( false ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, not visible ) 
    end 
end, false ) 
  

server

addEventHandler ("onPlayerJoin", root, 
function() 
triggerClientEvent ( "lobby", getRootElement()) 
end) 
  

And it doesn't work when i join, why?

Link to comment

try this:

local bg = { 
    ["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/bg.png", true) 
} 
for _,gui in pairs(bg)do 
    guiSetVisible(gui,false) 
end 
guiSetEnabled (bg["bg"], false ) 
local ikony = { 
    ["dd"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/dd.png", true), -- Obdélník 
    ["drift"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/drift.png", true), -- Čtverec 
    ["parkour"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/parkour.png", true), -- Čtverec 
    ["trials"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/trials.png", true), -- Čtverec 
    ["shooter"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/shooter.png", true), -- Čtverec 
    ["dm"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/dm.png", true), -- Obdélník         
    ["hunter"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/hunter.png", true), -- Obdélník 
    ["zombie"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/zombie.png", true), -- Obdélník 
    ["slender"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/slender.png", true), -- Obdélník 
    ["race"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/race.png", true), -- Obdélník 
    ["counterstrike"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/counterstrike.png", true), -- Obdélník 
} 
for _,image in pairs(ikony)do 
    guiSetAlpha(image,0.75) 
end 
for _,gui in pairs(ikony)do 
    guiSetVisible(gui,false) 
end 
    
local labely = { 
    ["hraci"] = guiCreateLabel(0.00, 0.85, 1.00, 0.14, "Players: ".. tostring( #getElementsByType( "player" ) ), true) 
} 
local font2 = guiCreateFont( "lithos.ttf", 50 ) 
guiSetFont( labely["hraci"], font2 ) 
guiLabelSetHorizontalAlign(labely["hraci"], "center", false) 
guiLabelSetVerticalAlign(labely["hraci"], "center") 
for _,gui in pairs(labely)do 
    guiSetVisible(gui,false) 
end 
  
--[[guiSetAlpha (ikony["dd"], 0.75 ) 
guiSetAlpha (ikony["drift"], 0.75 ) 
guiSetAlpha (ikony["parkour"], 0.75 ) 
guiSetAlpha (ikony["trials"], 0.75 ) 
guiSetAlpha (ikony["shooter"], 0.75 ) 
guiSetAlpha (ikony["dm"], 0.75 ) 
guiSetAlpha (ikony["hunter"], 0.75 ) 
guiSetAlpha (ikony["zombie"], 0.75 ) 
guiSetAlpha (ikony["slender"], 0.75 ) 
guiSetAlpha (ikony["race"], 0.75 ) 
guiSetAlpha (ikony["counterstrike"], 0.75 )]] 
  
addEventHandler ( "onClientMouseEnter", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 1 ) 
            break 
        end 
    end 
end) 
addEventHandler ( "onClientMouseLeave", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 0.75 ) 
            break 
        end 
    end 
end) 
  
  
  
local visible = true 
function lobby() 
    visible =  not visible 
    showCursor ( visible ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, visible ) 
    end 
end 
addEvent( "lobby", true) 
addEventHandler( "lobby", getRootElement(), lobby) 
bindKey ("F1", "down",lobby) 
  
  
addEventHandler ( "onClientGUIClick", ikony["dm"], function(button) 
    if button ~= "left" then return end 
    showCursor ( false ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, not visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, not visible ) 
    end 
end, false ) 

Link to comment

Try this:

Server

addEventHandler ("onPlayerJoin", root,function() 
    triggerClientEvent (source,"lobby",source) 
end) 

Client

local bg = { 
    ["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/bg.png", true) 
} 
for _,gui in pairs(bg)do 
    guiSetVisible(gui,false) 
end 
guiSetEnabled (bg["bg"], false ) 
local ikony = { 
    ["dd"] = guiCreateStaticImage(0.09, 0.11, 0.27, 0.20, "img/dd.png", true), -- Obdélník 
    ["drift"] = guiCreateStaticImage(0.09, 0.32, 0.13, 0.20, "img/drift.png", true), -- Čtverec 
    ["parkour"] = guiCreateStaticImage(0.2296, 0.32, 0.13, 0.20, "img/parkour.png", true), -- Čtverec 
    ["trials"] = guiCreateStaticImage(0.507, 0.11, 0.13, 0.20, "img/trials.png", true), -- Čtverec 
    ["shooter"] = guiCreateStaticImage(0.368, 0.11, 0.13, 0.20, "img/shooter.png", true), -- Čtverec 
    ["dm"] = guiCreateStaticImage(0.368, 0.32, 0.27, 0.20, "img/dm.png", true), -- Obdélník         
    ["hunter"] = guiCreateStaticImage(0.368, 0.53, 0.27, 0.20, "img/hunter.png", true), -- Obdélník 
    ["zombie"] = guiCreateStaticImage(0.646, 0.53, 0.27, 0.20, "img/zombie.png", true), -- Obdélník 
    ["slender"] = guiCreateStaticImage(0.646, 0.32, 0.27, 0.20, "img/slender.png", true), -- Obdélník 
    ["race"] = guiCreateStaticImage(0.646, 0.11, 0.27, 0.20, "img/race.png", true), -- Obdélník 
    ["counterstrike"] = guiCreateStaticImage(0.09, 0.53, 0.27, 0.20, "img/counterstrike.png", true), -- Obdélník 
} 
for _,image in pairs(ikony)do 
    guiSetAlpha(image,0.75) 
end 
for _,gui in pairs(ikony)do 
    guiSetVisible(gui,false) 
end 
    
local labely = { 
    ["hraci"] = guiCreateLabel(0.00, 0.85, 1.00, 0.14, "Players: ".. tostring( #getElementsByType( "player" ) ), true) 
} 
local font2 = guiCreateFont( "lithos.ttf", 50 ) 
guiSetFont( labely["hraci"], font2 ) 
guiLabelSetHorizontalAlign(labely["hraci"], "center", false) 
guiLabelSetVerticalAlign(labely["hraci"], "center") 
for _,gui in pairs(labely)do 
    guiSetVisible(gui,false) 
end 
  
--[[guiSetAlpha (ikony["dd"], 0.75 ) 
guiSetAlpha (ikony["drift"], 0.75 ) 
guiSetAlpha (ikony["parkour"], 0.75 ) 
guiSetAlpha (ikony["trials"], 0.75 ) 
guiSetAlpha (ikony["shooter"], 0.75 ) 
guiSetAlpha (ikony["dm"], 0.75 ) 
guiSetAlpha (ikony["hunter"], 0.75 ) 
guiSetAlpha (ikony["zombie"], 0.75 ) 
guiSetAlpha (ikony["slender"], 0.75 ) 
guiSetAlpha (ikony["race"], 0.75 ) 
guiSetAlpha (ikony["counterstrike"], 0.75 )]] 
  
local visible = false 
  
addEventHandler ( "onClientMouseEnter", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 1 ) 
            break 
        end 
    end 
end) 
addEventHandler ( "onClientMouseLeave", root,function ( aX, aY ) 
    for _, gui in pairs ( ikony ) do 
        if ( gui == source ) then 
            guiSetAlpha ( source, 0.75 ) 
            break 
        end 
    end 
end) 
  
addEventHandler ( "onClientGUIClick", ikony["dm"], function(button) 
    if button ~= "left" then return end 
    visible = not visible 
    showCursor ( visible ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, visible ) 
    end 
end, false ) 
  
function lobby() 
    visible =  not visible 
    showCursor ( visible ) 
    for _, gui in pairs ( ikony ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( bg ) do 
        guiSetVisible ( gui, visible ) 
    end 
    for _, gui in pairs ( labely ) do 
        guiSetVisible ( gui, visible ) 
    end 
end 
addEvent( "lobby", true) 
addEventHandler( "lobby",localPlayer, lobby) 
bindKey ("F1", "down",lobby) 

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