Jump to content

[HELP] GUI in marker ain't showing


Recommended Posts

Please before you comment stuff, you should know that I am 13 years old and I'm a web programmer (decent) HTML,CSS and PHP. I want to get to known Lua since I'm also helping my friend make a server. I've used GUI Editor to make a GUI for an upcoming Garage System and when I enter the marker nothing shows up. No errors, No outputs, nothing.

--[[------------------------------------------------- 
Notes: 
  
> This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. 
    To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. 
--]]------------------------------------------------- 
marker = createMarker(-2547.4677734375, 648.90625, 26.8125, "cylinder", 2, 255, 145, 0, 255) 
  
        GUIEditor.window[1] = guiCreateWindow(393, 175, 584, 428, "StoryRoam - Garage System", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFF9100") 
  
        GUIEditor.staticimage[1] = guiCreateStaticImage(13, 23, 142, 146, ":SRhousing/images/script/house_.png", false, GUIEditor.window[1]) 
        GUIEditor.label[1] = guiCreateLabel(163, 37, 402, 16, "Here you may buy a garage and store your vehicles inside it.", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[1], 255, 145, 0) 
        GUIEditor.label[2] = guiCreateLabel(162, 54, 403, 18, "There is no annoying confirm buttons so It's simple to buy a garage!", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[2], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[2], 255, 145, 0) 
        GUIEditor.label[3] = guiCreateLabel(160, 72, 405, 15, "If you are interested in buying a garage then just click buttons below. \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" />", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[3], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[3], 255, 145, 0) 
        GUIEditor.label[4] = guiCreateLabel(156, 86, 409, 15, "___________________________________________________________________________________", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[4], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[4], 255, 145, 0) 
        GUIEditor.label[5] = guiCreateLabel(52, 169, 143, 15, "Information", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[5], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[5], 255, 145, 0) 
        GUIEditor.label[6] = guiCreateLabel(20, 186, 140, 219, "\nType: Regular Garage\n\nPrice: 45,000$\n\nCapacity: 2 Vehicles\n____________________________________\n", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[6], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[6], 255, 145, 0) 
        GUIEditor.button[1] = guiCreateButton(13, 361, 157, 29, "Buy Garage", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF9100") 
        GUIEditor.button[2] = guiCreateButton(195, 359, 180, 31, "Exit", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF9100") 
        GUIEditor.button[3] = guiCreateButton(388, 359, 167, 31, "Enter the garage", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[3], "default-bold-small") 
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFF9100") 
        GUIEditor.staticimage[2] = guiCreateStaticImage(421, 288, 93, 61, ":SRhousing/images/script/icon_enter.png", false, GUIEditor.window[1]) 
        GUIEditor.staticimage[3] = guiCreateStaticImage(47, 295, 85, 56, ":SRhousing/images/script/icon_buy.png", false, GUIEditor.window[1]) 
        GUIEditor.staticimage[4] = guiCreateStaticImage(235, 296, 90, 47, ":SRhousing/images/script/icon_destroy.png", false, GUIEditor.window[1]) 
        GUIEditor.label[7] = guiCreateLabel(154, 99, 16, 174, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[7], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[7], 255, 145, 0) 
        GUIEditor.label[8] = guiCreateLabel(159, 99, 406, 164, "\n\nQuestions & Answers\n\n-Why would I buy a garage?\nTo store your vehicles and have them safe \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" />\n-Do I get refunds If I buy it by accident?\nOfcourse you do!\n-Will I receive any rewards for reporting bugs?\nYes, You will be money rewarded or anything.", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[8], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[8], 255, 145, 0)     
  
function close() 
         if (source == GUIEditor.button[2]) then 
         guiSetVisible(GUIEditor.window[1],false) 
         showCursor(false) 
         end 
    end 
    addEventHandler("onClientGUIClick", GUIEditor.button[2], close) 
     
    function showgui (hitElement) 
         if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(GUIEditor.window[1]) then 
                       guiSetVisible(GUIEditor.window[1], true) 
                       showCursor(true) 
                  end 
         end 
    end 
    addEventHandler("onClientMarkerHit", marker, showgui) 
  
    function showguil (leaveElement) 
         if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                  if guiGetVisible(GUIEditor.window[1]) then 
                       guiSetVisible(GUIEditor.window[1], false) 
                       showCursor(false) 
                  end 
         end 
    end 
    addEventHandler("onClientMarkerLeave", marker, showguil) 

peace... It's client sided.

Link to comment

Can't really find anything that seems wrong in your script but there are two things you might want to try after all:

  • Don't name your marker variable "marker" since it's also a class name, use something else instead. And don't forget the event handlers.
  • You might also add the second argument to the hit and leave functions which is matching dimension: https://wiki.multitheftauto.com/wiki/OnClientMarkerHit

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...