AlvareZ_ Posted June 10, 2013 Share Posted June 10, 2013 I wanna the player hit the maker after show the gui, not debugscript error: local sWidth,sHeight = guiGetScreenSize() local entrada = createMarker (2790.69849, -1618.30640, 15.35537, "cylinder", 1.5, 255, 255, 0, 170 ) function main () setTimer ( function() texto = dxDrawText("Tienda de Armas", sWidth*0.580, sHeight*0.189, sWidth*0.893, sHeight*0.215, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) addEventHandler ( "onClientRender", root, texto ) GUIEditor.gridlist[1] = guiCreateGridList(sWidth*0.394, sHeight*0.236, sWidth*0.252, sHeight*0.296, false) guiGridListAddColumn(GUIEditor.gridlist[1], "Armas", 0.9) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Uzi", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Tec-9", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "Sniper", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Shotgun", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 1, "Satchel", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 1, "Recortada", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 6, 1, "Rifle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 7, 1, "Paracaidas", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 8, 1, "MP5", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 9, 1, "M4", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 10, 1, "Knife", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 11, 1, "Katana", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 12, 1, "Grenade", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 13, 1, "Desert Eagle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 14, 1, "Combat Shotgun", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 15, 1, "Colt", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 16, 1, "Chainsaw", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 17, 1, "AK-47", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 18, 1, "Visores Nocturnos", false, false) GUIEditor.button[1] = guiCreateButton(sWidth*0.699, sHeight*0.466, sWidth*0.235, sHeight*0.049, "Comprar", false) GUIEditor.label[4] = guiCreateLabel(sWidth*0.718, sHeight*0.371, sWidth*0.190, sHeight*0.017, "Nombre: ---", false) GUIEditor.label[5] = guiCreateLabel(sWidth*0.718, sHeight*0.389, sWidth*0.190, sHeight*0.015, "Municiones: ---", false) GUIEditor.label[7] = guiCreateLabel(sWidth*0.718, sHeight*0.410, sWidth*0.190, sHeight*0.016, "Nivel: ---", false) GUIEditor.label[8] = guiCreateLabel(sWidth*0.718, sHeight*0.424, sWidth*0.190, sHeight*0.021, "Precio: ---", false) muestra = guiCreateStaticImage(sWidth*0.717, sHeight*0.234, sWidth*0.191, sHeight*0.126, ":admin/client/images/info.png", false) addEventHandler("onClientRender", root, render ) end, 5000, 1 ) end addEventHandler("onMarkerHit", entrada, main) function render() dxDrawRectangle(sWidth*0.384, sHeight*0.219, sWidth*0.567, sHeight*0.332, tocolor(0, 0, 0, 240), true) dxDrawRectangle(sWidth*0.384, sHeight*0.194, sWidth*0.567, sHeight*0.025, tocolor(4, 75, 74, 240), true) end Link to comment
xXMADEXx Posted June 10, 2013 Share Posted June 10, 2013 When ever you are dealing with DX functions, you have to add "onClientRender" to the function. Link to comment
xXMADEXx Posted June 10, 2013 Share Posted June 10, 2013 with "addEventHandler("onClientRender",root,functionName)" Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 See the parts: function main () setTimer ( function() texto = dxDrawText("Tienda de Armas", sWidth*0.580, sHeight*0.189, sWidth*0.893, sHeight*0.215, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) addEventHandler ( "onClientRender", root, texto ) and muestra = guiCreateStaticImage(sWidth*0.717, sHeight*0.234, sWidth*0.191, sHeight*0.126, ":admin/client/images/info.png", false) addEventHandler("onClientRender", root, render ) end, 5000, 1 ) end addEventHandler("onMarkerHit", entrada, main) Link to comment
xXMADEXx Posted June 10, 2013 Share Posted June 10, 2013 Try this: local sWidth,sHeight = guiGetScreenSize() local entrada = createMarker (2790.69849, -1618.30640, 15.35537, "cylinder", 1.5, 255, 255, 0, 170 ) local isPlayerRending = false function main () setTimer ( function() if not isPlayerRending then addEventHandler("onClientRender", root, render ) end GUIEditor.gridlist[1] = guiCreateGridList(sWidth*0.394, sHeight*0.236, sWidth*0.252, sHeight*0.296, false) guiGridListAddColumn(GUIEditor.gridlist[1], "Armas", 0.9) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Uzi", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Tec-9", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "Sniper", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Shotgun", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 1, "Satchel", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 1, "Recortada", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 6, 1, "Rifle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 7, 1, "Paracaidas", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 8, 1, "MP5", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 9, 1, "M4", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 10, 1, "Knife", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 11, 1, "Katana", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 12, 1, "Grenade", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 13, 1, "Desert Eagle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 14, 1, "Combat Shotgun", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 15, 1, "Colt", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 16, 1, "Chainsaw", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 17, 1, "AK-47", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 18, 1, "Visores Nocturnos", false, false) GUIEditor.button[1] = guiCreateButton(sWidth*0.699, sHeight*0.466, sWidth*0.235, sHeight*0.049, "Comprar", false) GUIEditor.label[4] = guiCreateLabel(sWidth*0.718, sHeight*0.371, sWidth*0.190, sHeight*0.017, "Nombre: ---", false) GUIEditor.label[5] = guiCreateLabel(sWidth*0.718, sHeight*0.389, sWidth*0.190, sHeight*0.015, "Municiones: ---", false) GUIEditor.label[7] = guiCreateLabel(sWidth*0.718, sHeight*0.410, sWidth*0.190, sHeight*0.016, "Nivel: ---", false) GUIEditor.label[8] = guiCreateLabel(sWidth*0.718, sHeight*0.424, sWidth*0.190, sHeight*0.021, "Precio: ---", false) muestra = guiCreateStaticImage(sWidth*0.717, sHeight*0.234, sWidth*0.191, sHeight*0.126, ":admin/client/images/info.png", false) end, 5000, 1 ) end addEventHandler("onMarkerHit", entrada, main) function render() isPlayerRending = true dxDrawText("Tienda de Armas", sWidth*0.580, sHeight*0.189, sWidth*0.893, sHeight*0.215, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawRectangle(sWidth*0.384, sHeight*0.219, sWidth*0.567, sHeight*0.332, tocolor(0, 0, 0, 240), true) dxDrawRectangle(sWidth*0.384, sHeight*0.194, sWidth*0.567, sHeight*0.025, tocolor(4, 75, 74, 240), true) end Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 not work, not debug error's Link to comment
Castillo Posted June 10, 2013 Share Posted June 10, 2013 Since is a client side script, you must use "onClientMarkerHit". Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 Hehe, Thanks, but now create only the dx Guis and text but not create the Gridlist, image, label and button Link to comment
Castillo Posted June 10, 2013 Share Posted June 10, 2013 That's because you forgot the GUIeditor table, which you can notice by using the debugscript. local sWidth, sHeight = guiGetScreenSize ( ) local entrada = createMarker ( 2790.69849, -1618.30640, 15.35537, "cylinder", 1.5, 255, 255, 0, 170 ) local isPlayerRending = false local GUIEditor = { gridlist = { }, button = { }, label = { } } function main ( hitElement ) if ( hitElement ~= localPlayer ) then return end setTimer ( function ( ) if ( not isPlayerRending ) then addEventHandler ( "onClientRender", root, render ) end GUIEditor.gridlist[1] = guiCreateGridList(sWidth*0.394, sHeight*0.236, sWidth*0.252, sHeight*0.296, false) guiGridListAddColumn(GUIEditor.gridlist[1], "Armas", 0.9) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Uzi", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Tec-9", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "Sniper", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Shotgun", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 1, "Satchel", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 1, "Recortada", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 6, 1, "Rifle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 7, 1, "Paracaidas", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 8, 1, "MP5", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 9, 1, "M4", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 10, 1, "Knife", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 11, 1, "Katana", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 12, 1, "Grenade", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 13, 1, "Desert Eagle", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 14, 1, "Combat Shotgun", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 15, 1, "Colt", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 16, 1, "Chainsaw", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 17, 1, "AK-47", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 18, 1, "Visores Nocturnos", false, false) GUIEditor.button[1] = guiCreateButton(sWidth*0.699, sHeight*0.466, sWidth*0.235, sHeight*0.049, "Comprar", false) GUIEditor.label[4] = guiCreateLabel(sWidth*0.718, sHeight*0.371, sWidth*0.190, sHeight*0.017, "Nombre: ---", false) GUIEditor.label[5] = guiCreateLabel(sWidth*0.718, sHeight*0.389, sWidth*0.190, sHeight*0.015, "Municiones: ---", false) GUIEditor.label[7] = guiCreateLabel(sWidth*0.718, sHeight*0.410, sWidth*0.190, sHeight*0.016, "Nivel: ---", false) GUIEditor.label[8] = guiCreateLabel(sWidth*0.718, sHeight*0.424, sWidth*0.190, sHeight*0.021, "Precio: ---", false) muestra = guiCreateStaticImage(sWidth*0.717, sHeight*0.234, sWidth*0.191, sHeight*0.126, ":admin/client/images/info.png", false) end ,5000, 1 ) end addEventHandler ( "onClientMarkerHit", entrada, main ) function render ( ) isPlayerRending = true dxDrawText("Tienda de Armas", sWidth*0.580, sHeight*0.189, sWidth*0.893, sHeight*0.215, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawRectangle(sWidth*0.384, sHeight*0.219, sWidth*0.567, sHeight*0.332, tocolor(0, 0, 0, 240), false) dxDrawRectangle(sWidth*0.384, sHeight*0.194, sWidth*0.567, sHeight*0.025, tocolor(4, 75, 74, 240), false) end Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 Thanks you so much, but the list of the grindlist dont found, and a question, because the dx gui get cumshot ? Link to comment
Castillo Posted June 10, 2013 Share Posted June 10, 2013 That's because you didn't add the rows. Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 Ham yeah, sorry. But, You now why the dx gui are cumshot? i apply the sWidth,sHeight thus: Original: 668, 952, 715, 997 With sWidth,sHeight: sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997 anything error? Link to comment
Castillo Posted June 10, 2013 Share Posted June 10, 2013 I don't understand what do you mean. Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 How to use sWidth, sHeight. The original position are this: 384, 219, 567, 332 and i remplace to this: sWidth*0.384, sHeight*0.219, sWidth*0.567, sHeight*0.332 but the gui are cumshot aside Sorry for my bad english Link to comment
Castillo Posted June 10, 2013 Share Posted June 10, 2013 Take an screenshot of how does it look. Link to comment
AlvareZ_ Posted June 10, 2013 Author Share Posted June 10, 2013 This its: http://imageshack.us/photo/my-images/15 ... .png/?sa=0 Link to comment
iPrestege Posted June 11, 2013 Share Posted June 11, 2013 I don't understand what you want exactly , Let me guess .. You want to set the DX resolution for all screen size's ? Link to comment
denny199 Posted June 11, 2013 Share Posted June 11, 2013 https://wiki.multitheftauto.com/wiki/GuiGetScreenSize There are some calculations there 2. Divide each of the DX text's position values by the screen size manually (remembering the resolution is 1024x768): Left position value is 684, 684/1024 = 0.668 Top position value is 731, 731/768 = 0.952 Right position values is 732, 732/1024 = 0.715 Bottom position value is 766, 766/768 = 0.997 You may want to use a calculator to help you count. 3. Now with the answer above remove all of the position values and replace it with the width or height variable multiplied by the answer. Which would be: local sWidth,sHeight = guiGetScreenSize() -- The variables dxDrawText("Hello World!",sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) ---------------------------------------------------------------------------- So if you look at "2." then you need to calculate it like this: calc1 = Left position value / my local screenx = answer for all screen for next calculation screenX calc2 = Top position value / my local screeny = answer for all screen for next calculation screenY calc3 = Right position value/ my local screenx = answer for all screen for next calculation width calc4 = Bottom position value/ my local screeny = answer for all screen for next calculation height So after that you can use it like this: local sX,sY = guiGetScreenSize() sX*calc1, sY*calc2, sX*calc3, sY*calc4 This will be on all the resolutions the same. I hope that I helped you. Kindly regards, Danny 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