Jump to content

GUI problem


stefutz101

Recommended Posts

Hi . I wanna make a scoreboard but i have a problem . I created row and colums but they don't look really good. How i can fix that ?

Client-side

function scoreBoard () 
if getKeyState( "tab" ) == false then return end 
if getElementData(getLocalPlayer(),"logedin") then 
        window = guiCreateWindow(336, 131, 640, 495, "[RedFear]Top-DayZ International/Romanian", false) 
        guiWindowSetSizable(window, false) 
        playerList = guiCreateGridList(9, 26, 640, 495, false, window) 
        guiGridListAddColumn(playerList, "#", 0.1) 
        guiGridListAddColumn(playerList, "Name", 0.1) 
        guiGridListAddColumn(playerList, "Murders", 0.1) 
        guiGridListAddColumn(playerList, "Zombie killed", 0.1) 
        guiGridListAddColumn(playerList, "Alivetime", 0.1) 
        guiGridListAddColumn(playerList, "FPS", 0.1) 
        guiGridListAddColumn(playerList, "Ping", 0.1) 
        guiGridListAddRow(playerList) 
        for id, player in ipairs(getElementsByType("player")) do 
            local row = guiGridListAddRow ( playerList ) 
            guiGridListSetItemText ( playerList, id, 1, id, false, false ) 
            guiGridListSetItemText ( playerList, id, 2, getPlayerName ( player ), false, false ) 
            guiGridListSetItemText ( playerList, id, 3, getElementData(player,"murders")or 0, false, false ) 
            guiGridListSetItemText ( playerList, id, 4, getElementData(player,"zombieskilled")or 0, false, false ) 
            guiGridListSetItemText ( playerList, id, 5, formatTimeFromMinutes(getElementData(player,"alivetime") or 1), false, false ) 
            guiGridListSetItemText ( playerList, id, 6, getElementData(player,"FPS"), false, false ) 
            guiGridListSetItemText ( playerList, id, 7, getPlayerPing(player), false, false ) 
        end    
end 
end 
addEventHandler ( "onClientRender", getRootElement(), scoreBoard ) 

Link to comment

and if you want in center resolution use this:

function GUI () 
    guiSetVisible(window, not guiGetVisible (window)) 
    showCursor (not isCursorShowing()) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(window,x,y,false) 
end 
bindKey("tab","down", GUI) 

Link to comment

I'm trying to make a bind like this : if tab button it's pressed it display scoreboard , if not , scoreboard is hide.

@ 1LOL1 ok thanks :)

function toggle( player, key, keyState ) 
    if ( keyState == "down" ) then 
        showCursor(true) 
        guiSetVisible(window,true) 
    else 
        showCursor(false) 
        guiSetVisible(window,false) 
    end 
end 
bindKey("tab","down",toggle) 

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