• Announcements

    • jhxp

      Forums are online again after a maintenance.   18/03/17

      MTA Forums maintenance is completed, although some automatic time-heavy tasks are still in process and will be finished eventually in background. Expect some features such as Forum Search to not display all results until all processes are finished. Please let us know if you spot a forum feature that worked correctly before the maintenance but does not work anymore now. Thanks. --MTA Team

harryh

Members
  • Content count

    88
  • Joined

  • Last visited

Community Reputation

0 Neutral

About harryh

  • Rank
    Transformer
  1. Yes, Thank you, how can I move it over more to the right becauseI have DogCreate.Window = guiCreateWindow(x/2-0/2, y/2-284/2, 248, 284, "", false) and I cannot set the position code any lower than 0?
  2. Hi, thank you very much the GUI looks all correct now. What will I have to tweak to move it over to the right, I have tried editing position codes but i get to 0 and its still not over right far enough. DogCreate.Window = guiCreateWindow(x/2-0/2, y/2-284/2, 248, 284, "", false) Also how come you you have x/2-248/2 Also I understand how you mean is that I divide my screen with his screen so lets say x, y = guiGetScreenSize() His screen == 1280x720 fx, fy = 1920, 1080 lx, ly = 1280/1920, 1080/720 then you do lx * position code, ly*positioncode, width of window, height of window so guiCreateWindow(lx*poscode, ly*poscode, width of window, height of window) Is that understanding correct?
  3. Hi, I have set the code like yours but now the is hanging half off the screen on the left when it should be in top right corner. DogCreate.Window = guiCreateWindow(x/2-1517/2, y/2-119/2, 326, 270, "", false) How can I send you the font file.
  4. I have edited some stuff as said on the wiki to make GUI work on all resolution and it doesn't work still.. https://wiki.multitheftauto.com/wiki/GuiGetScreenSize The GUI looks better but is still very disfigured. local x,y = guiGetScreenSize() local xx = 1960 local yy = 1080 DogCreate.Window = guiCreateWindow(1517/1960*x, 119/1080*y, 326/1960*x, 270/1080*y, "", false) guiWindowSetMovable(DogCreate.Window, false) guiWindowSetSizable(DogCreate.Window, false) DogCreate.NameBox = guiCreateEdit(91/xx*x, 62/yy*y, 205/xx*x, 32/yy*y, "", false, DogCreate.Window) DogCreate.BreedBox = guiCreateComboBox(91/xx*x, 105/yy*y, 212/xx*x, 144/yy*y, "", false, DogCreate.Window) guiComboBoxAddItem(DogCreate.BreedBox, "German Sheperd") guiComboBoxAddItem(DogCreate.BreedBox, "Rottweiler") guiComboBoxAddItem(DogCreate.BreedBox, "Golden Retriever") guiComboBoxAddItem(DogCreate.BreedBox, "Pitbull") DogCreate.MaleRadio = guiCreateRadioButton(130/xx*x, 184/yy*y, 13/xx*x, 14/yy*y, "", false, DogCreate.Window) DogCreate.FemaleRadio = guiCreateRadioButton(192/xx*x, 181/yy*y, 13/xx*x, 14/yy*y, "", false, DogCreate.Window) DogCreate.BuyButton = guiCreateButton(23/xx*x, 205/yy*y, 280/xx*x, 54/yy*y, "Purchase Dog", false, DogCreate.Window) DogCreate.NameLab = guiCreateLabel(9/xx*x, 64/yy*y, 76/xx*x, 36/yy*y, "NAME:", false, DogCreate.Window) DogCreate.BreedLab = guiCreateLabel(8/xx*x, 106/yy*y, 77/xx*x, 24/yy*y, "BREED:", false, DogCreate.Window) DogCreate.MaLab = guiCreateLabel(130/xx*x, 165/yy*y, 16/xx*x, 16/yy*y, " M", false, DogCreate.Window) DogCreate.FeLab = guiCreateLabel(196/xx*x, 165/yy*y, 16/xx*x, 16/yy*y, " F", false, DogCreate.Window) DogCreate.WindowLab = guiCreateLabel(79/xx*x, 14/yy*y, 184/xx*x, 40/yy*y, "Dog Creator", false, DogCreate.Window) DogCreate.DogColorCombo = guiCreateComboBox(91/xx*x, 135/yy*y, 212/xx*x, 94/yy*y, "", false, DogCreate.Window) DogCreate.ColorLab = guiCreateLabel(8/xx*x, 131/yy*y, 77/xx*x, 25/yy*y, "Colour:", false, DogCreate.Window) local font0_intNameFont = guiCreateFont(":dogsystem/font.ttf", 20) guiSetFont(DogCreate.BuyButton, font0_intNameFont) Also is it possible to set the font size relative to the screen size?
  5. Try this function onPlayerTarget (targetElem, thePlayer ) if getElementType ( targetElem ) == "object" and getElementModel ( targetElem ) == 1557 then local px, py, pz = getElementPosition(source) local x, y, z = getElementPosition(targetElem) if tonumber(getDistanceBetweenPoints3D(x, y, z, getElementPosition(source))) < 20 then toggleControl ( source, "fire", false ) else toggleControl ( source, "fire", true ) end else outputChatBox("No Target", source) end end addEventHandler ( "onPlayerTarget", root, onPlayerTarget ) Also expected element = boolean means there was no target so targetElem was returning false meaning all code below this if ( getElementModel ( targetElem ) == 1557 ) then will not be triggered.
  6. Model is not defined in the script above. Model just equals a number. (1557) Also, onClientResourceStart means that this code will only run when the resource starts and it will never run again.
  7. Also, What is with this. It works within the GUI editor but not when its put into practice. This relative thing doesn't work. Why does it work here?
  8. Hi, thank you but I have other variables that reference to all the GUI items in my code above. Therefore, I cant use edit boxes so this will not work. I will try and change too see what happens
  9. Hi, Im a bit confused how to use this above^ I used GUI editor to change all of the GUI items to relative but it still does the same thing: DogCreate.Window = guiCreateWindow(0.79, 0.11, 0.17, 0.25, "", true) DogCreate.BuyButton = guiCreateButton(0.07, 0.76, 0.86, 0.20, "Purchase Dog", true, DogCreate.Window) DogCreate.NameLab = guiCreateLabel(0.03, 0.24, 0.23, 0.13, "NAME:", true, DogCreate.Window) DogCreate.BreedLab = guiCreateLabel(0.02, 0.39, 0.24, 0.09, "BREED:", true, DogCreate.Window) DogCreate.MaLab = guiCreateLabel(0.40, 0.61, 0.05, 0.06, " M", true, DogCreate.Window) DogCreate.FeLab = guiCreateLabel(0.60, 0.61, 0.05, 0.06, " F", true, DogCreate.Window) DogCreate.WindowLab = guiCreateLabel(0.24, 0.05, 0.56, 0.15, "Dog Creator", true, DogCreate.Window) DogCreate.DogColorCombo = guiCreateComboBox(0.28, 0.50, 0.63, 0.12, "", true, DogCreate.Window) DogCreate.ColorLab = guiCreateLabel(0.02, 0.49, 0.24, 0.09, "Colour:", true, DogCreate.Window) DogCreate.BreedBox = guiCreateComboBox(0.28, 0.39, 0.63, 0.12, "", true, DogCreate.Window) DogCreate.MaleRadio = guiCreateRadioButton(0.40, 0.68, 0.04, 0.05, "", true, DogCreate.Window) DogCreate.FemaleRadio = guiCreateRadioButton(0.59, 0.67, 0.04, 0.05, "", true, DogCreate.Window) DogCreate.NameBox = guiCreateEdit(0.28, 0.23, 0.63, 0.12, "", true, DogCreate.Window)
  10. I have fixed the problem and I didn't know mta had DB functions that work for mysql. I thought it was only sqlite. Im not going to change everything because the mysql module works fine.
  11. I have told been that if I select relative position in the main parent window in gui editor it would work for all resolutions However is doesn't My Res: 1920*1080 His Res: 1280*720 His Screen: DogCreate.Window = guiCreateWindow(0.79, 0.11, 0.17, 0.25, "", true) guiWindowSetMovable(DogCreate.Window, false) guiWindowSetSizable(DogCreate.Window, false) guiSetProperty(DogCreate.Window, "TitlebarEnabled", "False") DogCreate.NameBox = guiCreateEdit(0.28, 0.23, 0.63, 0.12, "", true, DogCreate.Window) DogCreate.BreedBox = guiCreateComboBox(0.28, 0.39, 0.63, 0.12, "", true, DogCreate.Window) guiComboBoxAddItem(DogCreate.BreedBox, "German Sheperd") guiComboBoxAddItem(DogCreate.BreedBox, "Rottweiler") guiComboBoxAddItem(DogCreate.BreedBox, "Golden Retriever") guiComboBoxAddItem(DogCreate.BreedBox, "Pitbull") DogCreate.MaleRadio = guiCreateRadioButton(0.40, 0.68, 0.04, 0.05, "", true, DogCreate.Window) DogCreate.FemaleRadio = guiCreateRadioButton(0.60, 0.68, 0.04, 0.05, "", true, DogCreate.Window) DogCreate.BuyButton = guiCreateButton(0.07, 0.76, 0.86, 0.20, "Purchase Dog", true, DogCreate.Window) DogCreate.NameLab = guiCreateLabel(9, 64, 76, 36, "NAME:", false, DogCreate.Window) DogCreate.BreedLab = guiCreateLabel(8, 106, 77, 24, "BREED:", false, DogCreate.Window) DogCreate.MaLab = guiCreateLabel(0.40, 0.61, 0.05, 0.06, " M", true, DogCreate.Window) DogCreate.FeLab = guiCreateLabel(0.60, 0.61, 0.05, 0.06, " F", true, DogCreate.Window) DogCreate.WindowLab = guiCreateLabel(79, 14, 184, 40, "Dog Creator", false, DogCreate.Window) DogCreate.ColorLab = guiCreateLabel(8, 131, 77, 25, "Colour:", false, DogCreate.Window)
  12. Yes I see. Thank you. @Gordon_G
  13. Hi, so I have never really used event handlers properly so if I trigger a client event using the element getLocalPlayer() what must I put in the server add event handler to return the same element. I put getRootElement() but I think thats wrong. Code below is just an example of how I use addEventHandler Client: function check() triggerServerEvent("stuff", getLocalPlayer()) end addEventHandler("check", getLocalPlayer(), theFunction) server: addEventHandler("stuff", getRootElement(), stuffFunction) <------------ I would use this if calling in serverside because I dont know how to get the player. Normally I use source inside the function because that returns what executed the command or event Thanks
  14. HUD

    GUI Editor does stuff like that to me when you use Dx or its not in the place it should be. This was the reason I changed from using Dx as it never came out correct when I outputted the code.
  15. Hi, I cant seem to call a serverside event which runs a function to get infomation from the database then return it to clientside to update the clientside text label. Client: triggerServerEvent( "checkDog", getLocalPlayer( ) ) guiSetText( DogPanel.dogName, getDInfo["Name"] ) server: function loadPlayerInfo() local dbid = getElementData(source, "account:id") getDInfo = mysql:query_fetch_assoc("SELECT * FROM dogs WHERE pID = '" ..dbid.."'") gettheplayer = getPlayerName(source) outputChatBox("dbid:" ..tostring(dbid)) --InfoArray = getDInfo(result) if getDInfo then setElementData(source, "haveDog", true) outputChatBox("Your Dog is Called " ..getDInfo["Name"]) dogInfo = getDInfo getSkin = getDInfo["DogSkin"] return true, getDInfo elseif not getDInfo then setElementData(source, "haveDog", false) --No dog saved to DB outputChatBox("No Dog In DB.") else outputChatBox("Fatal Error has occured please contact administrator.") end end addEvent("checkDog", true) addEventHandler("checkDog", getRootElement(), loadPlayerInfo) addCommandHandler("loaddogs", loadPlayerInfo)