stefutz101 Posted February 12, 2016 Posted February 12, 2016 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 )
tosfera Posted February 12, 2016 Posted February 12, 2016 The last parameter of the function GuiGridListAddColumn is float width. As a total this would have to come out as 1.0. As far as you've created your GUI, it's 0.7. Increase the 0.1 where needed to fill the entire list.
stefutz101 Posted February 13, 2016 Author Posted February 13, 2016 Ok , ty fixed. I'm trying to make a bind on tab key . Something like : function bindtab() if getKeyState("tab")==true then setGuiVisible(window,true) else setGuiVisible(window,false) end end But it dosen't work any ideas ? Thanks.
tosfera Posted February 13, 2016 Posted February 13, 2016 depends on how you're binding the key. The most easy way to bind something like this would be; bindKey ( "tab", "down", guiSetVisile, window, not guiGetVisible ( window ) ); ( if it's client sided, of course. )
1LoL1 Posted February 13, 2016 Posted February 13, 2016 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)
stefutz101 Posted February 13, 2016 Author Posted February 13, 2016 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)
tosfera Posted February 13, 2016 Posted February 13, 2016 You can use the same bindkey as I gave you, just change the "down" to "up" in the duplicate so it goes like; bindKey ( "tab", "down", guiSetVisile, window, true ); bindKey ( "tab", "up", guiSetVisile, window, false );
stefutz101 Posted February 13, 2016 Author Posted February 13, 2016 Sorry . Now i saw your first comment . And yah it works , except function is called guiSetVisible , not guiSetVisile. Thanks man
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now