Nerox Posted August 1, 2013 Share Posted August 1, 2013 Hello guys. I'm scripting an Stats system, but somehow i can't get this to work: GUIEditor = { tab = {}, window = {}, tabpanel = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(555, 297, 565, 436, "Panel Hráča", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 25, 546, 401, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Štatistiky", GUIEditor.tabpanel[1]) GUIEditor.label[1] = guiCreateLabel(83, 41, 190, 18, "Typ", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 0, 126, 254) GUIEditor.label[2] = guiCreateLabel(273, 41, 190, 18, "Hodnota", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetColor(GUIEditor.label[2], 0, 126, 254) GUIEditor.label[3] = guiCreateLabel(83, 153, 190, 18, "Výrhy", false, GUIEditor.tab[1]) GUIEditor.label[4] = guiCreateLabel(83, 125, 190, 18, "Úmrtia", false, GUIEditor.tab[1]) GUIEditor.label[5] = guiCreateLabel(83, 97, 190, 18, "Peniaze", false, GUIEditor.tab[1]) GUIEditor.label[6] = guiCreateLabel(83, 69, 190, 18, "Body", false, GUIEditor.tab[1]) GUIEditor.label[7] = guiCreateLabel(273, 125, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[8] = guiCreateLabel(273, 97, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[9] = guiCreateLabel(273, 69, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[10] = guiCreateLabel(273, 153, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[11] = guiCreateLabel(246, 283, 267, 19, "www.webstranka.tk", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[11], "default-bold-small") GUIEditor.label[12] = guiCreateLabel(83, 181, 190, 18, "Nahraný Čas", false, GUIEditor.tab[1]) GUIEditor.label[13] = guiCreateLabel(273, 181, 190, 18, "", false, GUIEditor.tab[1]) end ) addEventHandler("onClientResourceStart", resourceRoot, function() local playermoney = getPlayerMoney ( source ) local playerpoints = getElementData(source,"Points") local playertime = getElementData(source,"Playtime") local playerwins = getElementData(source,"Wins") local playerdeaths = getElementData(source,"Deaths") guiSetText (GUIEditor.label[9], "" .. playerpoints .. "") guiSetText (GUIEditor.label[8], "" .. playermoney .. "") guiSetText (GUIEditor.label[7], "" .. playerdeaths .. "") guiSetText (GUIEditor.label[10], "" .. playerwins .. "") guiSetText (GUIEditor.label[13], "" .. playertime .. "") end ) addEventHandler("onClientRender", root, function() dxDrawLine(628, 408, 925, 408, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 493, 925, 493, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 465, 925, 465, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 438, 925, 438, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(762, 383, 762, 553, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 523, 925, 523, tocolor(255, 255, 255, 255), 1, true) end ) function guiToggleVisible ( GUIEditor.window[1] ) if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then guiSetVisible ( GUIEditor.window[1], false ) else guiSetVisible ( GUIEditor.window[1], true ) end end bindKey ( "f1", "down", guiToggleVisible ) I want the stats to show in the GUI, but the GUI won't open when i press F1. Any ideas why? Link to comment
iMr.3a[Z]eF Posted August 1, 2013 Share Posted August 1, 2013 Check if the freeroam is stoped: GUIEditor = { tab = {}, window = {}, tabpanel = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(555, 297, 565, 436, "Panel Hráča", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 25, 546, 401, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Štatistiky", GUIEditor.tabpanel[1]) GUIEditor.label[1] = guiCreateLabel(83, 41, 190, 18, "Typ", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 0, 126, 254) GUIEditor.label[2] = guiCreateLabel(273, 41, 190, 18, "Hodnota", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetColor(GUIEditor.label[2], 0, 126, 254) GUIEditor.label[3] = guiCreateLabel(83, 153, 190, 18, "Výrhy", false, GUIEditor.tab[1]) GUIEditor.label[4] = guiCreateLabel(83, 125, 190, 18, "Úmrtia", false, GUIEditor.tab[1]) GUIEditor.label[5] = guiCreateLabel(83, 97, 190, 18, "Peniaze", false, GUIEditor.tab[1]) GUIEditor.label[6] = guiCreateLabel(83, 69, 190, 18, "Body", false, GUIEditor.tab[1]) GUIEditor.label[7] = guiCreateLabel(273, 125, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[8] = guiCreateLabel(273, 97, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[9] = guiCreateLabel(273, 69, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[10] = guiCreateLabel(273, 153, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[11] = guiCreateLabel(246, 283, 267, 19, "www.webstranka.tk", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[11], "default-bold-small") GUIEditor.label[12] = guiCreateLabel(83, 181, 190, 18, "Nahraný Čas", false, GUIEditor.tab[1]) GUIEditor.label[13] = guiCreateLabel(273, 181, 190, 18, "", false, GUIEditor.tab[1]) end ) addEventHandler("onClientResourceStart", resourceRoot, function() local playermoney = getPlayerMoney ( source ) local playerpoints = getElementData(source,"Points") local playertime = getElementData(source,"Playtime") local playerwins = getElementData(source,"Wins") local playerdeaths = getElementData(source,"Deaths") guiSetText (GUIEditor.label[9], "" .. playerpoints .. "") guiSetText (GUIEditor.label[8], "" .. playermoney .. "") guiSetText (GUIEditor.label[7], "" .. playerdeaths .. "") guiSetText (GUIEditor.label[10], "" .. playerwins .. "") guiSetText (GUIEditor.label[13], "" .. playertime .. "") end ) addEventHandler("onClientRender", root, function() dxDrawLine(628, 408, 925, 408, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 493, 925, 493, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 465, 925, 465, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 438, 925, 438, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(762, 383, 762, 553, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 523, 925, 523, tocolor(255, 255, 255, 255), 1, true) end ) function guiToggleVisible ( ) guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ); showCursor ( guiGetVisible ( GUIEditor.window[1] ) ); end bindKey ( "f1", "down", guiToggleVisible ) Link to comment
Baseplate Posted August 1, 2013 Share Posted August 1, 2013 GUIEditor = { tab = {}, window = {}, tabpanel = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(555, 297, 565, 436, "Panel Hráča", false) guiSetVisible(GUIEditor.window[1], false) -- You forgot to make the gui invisible guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 25, 546, 401, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Štatistiky", GUIEditor.tabpanel[1]) GUIEditor.label[1] = guiCreateLabel(83, 41, 190, 18, "Typ", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 0, 126, 254) GUIEditor.label[2] = guiCreateLabel(273, 41, 190, 18, "Hodnota", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetColor(GUIEditor.label[2], 0, 126, 254) GUIEditor.label[3] = guiCreateLabel(83, 153, 190, 18, "Výrhy", false, GUIEditor.tab[1]) GUIEditor.label[4] = guiCreateLabel(83, 125, 190, 18, "Úmrtia", false, GUIEditor.tab[1]) GUIEditor.label[5] = guiCreateLabel(83, 97, 190, 18, "Peniaze", false, GUIEditor.tab[1]) GUIEditor.label[6] = guiCreateLabel(83, 69, 190, 18, "Body", false, GUIEditor.tab[1]) GUIEditor.label[7] = guiCreateLabel(273, 125, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[8] = guiCreateLabel(273, 97, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[9] = guiCreateLabel(273, 69, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[10] = guiCreateLabel(273, 153, 190, 18, "", false, GUIEditor.tab[1]) GUIEditor.label[11] = guiCreateLabel(246, 283, 267, 19, "www.webstranka.tk", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[11], "default-bold-small") GUIEditor.label[12] = guiCreateLabel(83, 181, 190, 18, "Nahraný Čas", false, GUIEditor.tab[1]) GUIEditor.label[13] = guiCreateLabel(273, 181, 190, 18, "", false, GUIEditor.tab[1]) addEventHandler("onClientRender", root, function() local playermoney = getPlayerMoney (localPlayer) -- next time use localPlayer instead of source in client side scripts local playerpoints = getElementData(localPlayer,"Points") local playertime = getElementData(localPlayer,"Playtime") local playerwins = getElementData(localPlayer,"Wins") local playerdeaths = getElementData(localPlayer,"Deaths") guiSetText (GUIEditor.label[9], "" .. playerpoints .. "") guiSetText (GUIEditor.label[8], "" .. playermoney .. "") guiSetText (GUIEditor.label[7], "" .. playerdeaths .. "") guiSetText (GUIEditor.label[10], "" .. playerwins .. "") guiSetText (GUIEditor.label[13], "" .. playertime .. "") end ) addEventHandler("onClientRender", root, function() dxDrawLine(628, 408, 925, 408, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 493, 925, 493, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 465, 925, 465, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 438, 925, 438, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(762, 383, 762, 553, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(628, 523, 925, 523, tocolor(255, 255, 255, 255), 1, true) end ) function guiToggleVisible () -- You had some issues here, fixed. guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end bindKey ( "F1", "down", guiToggleVisible ) Read the comments. Link to comment
Nerox Posted August 1, 2013 Author Share Posted August 1, 2013 Thank you, iMr.3a[Z]eF. abxf: iMr.3a[Z]eF was faster Link to comment
Castillo Posted August 1, 2013 Share Posted August 1, 2013 Check if the freeroam is stoped: That didn't make any sense, a key can be bound to a lot of things. Link to comment
Nerox Posted August 1, 2013 Author Share Posted August 1, 2013 About the Freeroam, i didn't have it ran, so it was not the problem. Anyway, thank you very much Link to comment
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