Chaos Posted June 17, 2013 Share Posted June 17, 2013 hi, i want to make guicreatelabel on the same place in all resolutions. guiCreateLabel(0.668,0.85,0.30,5,"Level: Unknown",true) can you help me with that please? Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 local screenWidth,screenHeight = guiGetScreenSize() guiCreateLabel( screenWidth*0.668/screenWidth,screenHeight*0.85/screenHeight,screenWidth*0.30/screenWidth,screenHeight*5/screenHeight,"Level: Unknown",true ) Not sure but it should work. Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 work but not staying on the same place when i change the resolution Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 work but not staying on the same place when i change the resolution use this resource, and use "set position code" for your guiwindow or DXtext, etc. Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 work but not staying on the same place when i change the resolution use this resource, and use "set position code" for your guiwindow or DXtext, etc. I forgot the link sorry https://community.multitheftauto.com/in ... ils&id=141 Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 not helping... We have u the answer, Try to use the position presets of "Set Position Code" function and see how it works Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 I going to make it for u, Tell me your screen resoulution. Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 I created an example Right Bottom for all resolutions addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() Example = guiCreateLabel(screenW - 578 - 10, (screenH - 91) - 20, 578, 91, "EXAMPLE", false) guiSetFont(Example, "sa-gothic") end ) Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 maaan look WTF?, i tested it in another monitor and works. Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 i just changed the resolution Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 My code should work fine as far as i know. Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 prestege still same problem Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 It works fine with me . No idea what's the problem with you. Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 It works fine with me . No idea what's the problem with you. It worked fine for me too. Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 so why dxdrawtext works fine and only guillabel don't work ? Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 can i replace this guilabel to dxdrawtext ? function clientsetupstarter(startedresource) if startedresource == getThisResource() then setTimer ( clientsetup, 1234, 1) MainClientTimer1 = setTimer ( zombie_check, 1000, 0) --STARTS THE TIMER TO CHECK FOR ZOMBIES ----this expLabel = guiCreateLabel(0.668,0.85,0.3000,5,"EXP gained: ??\nTotal EXP: ??\nLevel: Unknown",true) -- Start EXP and level system guiLabelSetColor(expLabel,255,0,0) guiLabelSetVerticalAlign(expLabel,"top") guiLabelSetHorizontalAlign(expLabel,"right",false) end end local ttlgnd = 0 function expChange(expr,gained) ttlgnd = ttlgnd+gained guiSetText(expLabel,"") local level,levelnum = "#0-Beginner",0 if expr >= 30 then level = "#1-Average" levelnum = 1 end if expr >= 70 then level = "#2-Good" levelnum = 2 end if expr >= 100 then level = "#3-Killer" levelnum = 3 end if expr >= 249 then level = "#4-Assassin" levelnum = 4 end if expr >= 600 then level = "#5-Blooder" levelnum = 5 end if expr >= 1499 then level = "#6-Skilled" levelnum = 6 end if expr >= 1999 then level = "#7-Elite" levelnum = 7 end if expr >= 2999 then level = "#8-Senior" levelnum = 8 end if expr >= 3999 then level = "#9-Amazing" levelnum = 9 end if expr >= 4999 then level = "#10-Predator" levelnum = 10 end if expr >= 5999 then level = "#11-ZombieKiller" levelnum = 11 end if expr >= 6999 then level = "#12-Hacker" levelnum = 12 end if expr >= 7999 then level = "#13-Psychopath" levelnum = 13 end if expr >= 8999 then level = "#14-Professional" levelnum = 14 end if expr >= 9999 then level = "#15-Godlike" levelnum = 15 end if expr >= 10000000 then level = "#16-God" levelnum = 16 end guiSetText(expLabel,"EXP gained: "..ttlgnd.." (+"..gained..")\nTotal EXP: "..expr.."\nLevel: "..level) setElementData(getLocalPlayer(),"Level",level) setElementData(getLocalPlayer(),"levelnum",levelnum) end addEvent( "expOnChange", true ) addEventHandler( "expOnChange", getRootElement(), expChange ) addEventHandler("onClientResourceStart", getRootElement(), clientsetupstarter) Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 can i replace this guilabel to dxdrawtext ? function clientsetupstarter(startedresource) if startedresource == getThisResource() then setTimer ( clientsetup, 1234, 1) MainClientTimer1 = setTimer ( zombie_check, 1000, 0) --STARTS THE TIMER TO CHECK FOR ZOMBIES ----this expLabel = guiCreateLabel(0.668,0.85,0.3000,5,"EXP gained: ??\nTotal EXP: ??\nLevel: Unknown",true) -- Start EXP and level system guiLabelSetColor(expLabel,255,0,0) guiLabelSetVerticalAlign(expLabel,"top") guiLabelSetHorizontalAlign(expLabel,"right",false) end end local ttlgnd = 0 function expChange(expr,gained) ttlgnd = ttlgnd+gained guiSetText(expLabel,"") local level,levelnum = "#0-Beginner",0 if expr >= 30 then level = "#1-Average" levelnum = 1 end if expr >= 70 then level = "#2-Good" levelnum = 2 end if expr >= 100 then level = "#3-Killer" levelnum = 3 end if expr >= 249 then level = "#4-Assassin" levelnum = 4 end if expr >= 600 then level = "#5-Blooder" levelnum = 5 end if expr >= 1499 then level = "#6-Skilled" levelnum = 6 end if expr >= 1999 then level = "#7-Elite" levelnum = 7 end if expr >= 2999 then level = "#8-Senior" levelnum = 8 end if expr >= 3999 then level = "#9-Amazing" levelnum = 9 end if expr >= 4999 then level = "#10-Predator" levelnum = 10 end if expr >= 5999 then level = "#11-ZombieKiller" levelnum = 11 end if expr >= 6999 then level = "#12-Hacker" levelnum = 12 end if expr >= 7999 then level = "#13-Psychopath" levelnum = 13 end if expr >= 8999 then level = "#14-Professional" levelnum = 14 end if expr >= 9999 then level = "#15-Godlike" levelnum = 15 end if expr >= 10000000 then level = "#16-God" levelnum = 16 end guiSetText(expLabel,"EXP gained: "..ttlgnd.." (+"..gained..")\nTotal EXP: "..expr.."\nLevel: "..level) setElementData(getLocalPlayer(),"Level",level) setElementData(getLocalPlayer(),"levelnum",levelnum) end addEvent( "expOnChange", true ) addEventHandler( "expOnChange", getRootElement(), expChange ) addEventHandler("onClientResourceStart", getRootElement(), clientsetupstarter) You can't use a similar " guiSetText" Function to the dxTexts. (Doesn't exist) You need to change a lot of things. Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 so what should i do now ? Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 so what should i do now ? Put the label in a GUI WINDOW and set the alpha of the window to 0. Link to comment
Chaos Posted June 17, 2013 Author Share Posted June 17, 2013 you mean like this? GUIEditor = { window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.78, 0.82, 0.21, 0.18, "", true) expLabel = guiCreateLabel(0.668,0.85,0.30,5,"EXP gained: ??\nTotal EXP: ??\nLevel: Unknown",true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.00) end ) Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 you mean like this? GUIEditor = { window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.78, 0.82, 0.21, 0.18, "", true) expLabel = guiCreateLabel(0.668,0.85,0.30,5,"EXP gained: ??\nTotal EXP: ??\nLevel: Unknown",true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.00) end ) yeah but use the ScreenH and ScreenW. Link to comment
mcer Posted June 17, 2013 Share Posted June 17, 2013 Read it for more information: https://wiki.multitheftauto.com/wiki/GuiGetScreenSize 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