Jump to content

Cannot see gui


Matevsz

Recommended Posts

Hi, after entering the marker does not show the gui.

 

marker = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1, 255, 0, 0, 0)

local screenW, screenH = guiGetScreenSize()
function GUI()
  window = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "GUI", false)
        guiWindowSetSizable(window, false)
  
  closeButton = guiCreateButton(413, 328, 187, 34, "Close", false, window)
  
  addEventHandler("onClientMarkerHit", marker, function()
        	guiSetVisible(window, true)
        	showCursor(true)
        end) 
  
  addEventHandler("onClientGUIClick", closeButton, function()
      guiSetVisible(window, false)
      showCursor(false)
  		end)
end

 

Edited by Matevsz
Link to comment

This could help ;)

marker = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1.1, 255, 0, 0, 0)

local screenW, screenH = guiGetScreenSize()
function GUI()
  window = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "GUI", false)
        guiWindowSetSizable(window, false)
  
  closeButton = guiCreateButton(413, 328, 187, 34, "Close", false, window)
  
  addEventHandler("onClientMarkerHit", marker, function()
        	guiSetVisible(window, true)
        	showCursor(true)
        end) 
  
  addEventHandler("onClientGUIClick", closeButton, function()
      guiSetVisible(window, false)
      showCursor(false)
  		end)
end

Btw, why did you made your marker invisible? It's better to use colshapes then

Link to comment

Remove the function GUI around your code.

marker = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1, 255, 0, 0, 255)

local screenW, screenH = guiGetScreenSize()
window = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "GUI", false)
guiWindowSetSizable(window, false)
  
closeButton = guiCreateButton(413, 328, 187, 34, "Close", false, window)
  
addEventHandler("onClientMarkerHit", marker, function()
	guiSetVisible(window, true)
	showCursor(true)
end) 
  
addEventHandler("onClientGUIClick", closeButton, function()
	guiSetVisible(window, false)
	showCursor(false)
end)

 

Link to comment
15 hours ago, Miika said:

This could help ;)


marker = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1.1, 255, 0, 0, 0)

local screenW, screenH = guiGetScreenSize()
function GUI()
  window = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "GUI", false)
        guiWindowSetSizable(window, false)
  
  closeButton = guiCreateButton(413, 328, 187, 34, "Close", false, window)
  
  addEventHandler("onClientMarkerHit", marker, function()
        	guiSetVisible(window, true)
        	showCursor(true)
        end) 
  
  addEventHandler("onClientGUIClick", closeButton, function()
      guiSetVisible(window, false)
      showCursor(false)
  		end)
end

Btw, why did you made your marker invisible? It's better to use colshapes then

Because, I don't like markers. Can you give me an example of how to use colshapes?

Link to comment
1 hour ago, Matevsz said:

Because, I don't like markers. Can you give me an example of how to use colshapes?

There's many different colshapes. See colShape in wiki. createColSphere or createColTube would be best for replacing marker, personally I like to use createColSphere.

colshape createColSphere ( float fX, float fY, float fZ, float fRadius )

So just x, y, z and size.

Example, how to use it:

local col = createColSphere(-2050.5, 167.39999, 27.9, 1)

addEventHandler("onColShapeHit", col,
function(hitElement)
    if getElementType(hitElement) == "player" then
      outputChatBox(getPlayerName(hitElement) .. " entered colshape.")
    end
end
    
addEventHandler("onColShapeLeave", col,
function(hitElement)
    if getElementType(hitElement) == "player" then
      outputChatBox(getPlayerName(hitElement) .. " t colshape.")
    end
end

 

Edited by Miika
Link to comment
9 minutes ago, Miika said:

There's many different colshapes. See colShape in wiki. createColSphere or createColTube would be best for replacing marker, personally I like to use createColSphere.


colshape createColSphere ( float fX, float fY, float fZ, float fRadius )

So just x, y, z and size.

Example, how to use it:


local col = createColSphere(-2050.5, 167.39999, 27.9, 1)

addEventHandler("onColShapeHit", col,
function(hitElement)
    if getElementType(hitElement) == "player" then
      outputChatBox(getPlayerName(hitElement) .. " entered colshape.")
    end
end
    
addEventHandler("onColShapeLeave", col,
function(hitElement)
    if getElementType(hitElement) == "player" then
      outputChatBox(getPlayerName(hitElement) .. " t colshape.")
    end
end

 

Okay. Thanks.

 

You could still help me with the object / Scroll Bar / and lifting?

guiScrollBarSetScrollPosition(scroll, 0)

Scroll is set to 0.

 

X, Y, Z, X1, Y2, Z2, Object:

min. = -2052.5, 170.3, 27.5, 0, 0, 90
max. = -2052.5, 170.3, 27.1, 0, 0, 90

Now how to lift up an object using scrollBar?

 

 

Link to comment

Sure,

Add this to function, which is triggered when gui opens:

Renderobjects = true

And this to function which triggers when gui closes: Renderobjects = false

Now add this on bottom of your script:

Object = createObject(--your argument here)
local ox, oy, oz = getElementPosition(Object)
Summary = 0.4 -- amount, how much your object goes upwards
  
addEventHandler("onClientRender", root,
function()
   if Renderobjects then
      local scpos = guiScrollBarGetScrollPosition(scroll)
      setElementPosition(Object, ox, oy, oz+(scpos*Summary*0.01))
   end
end
)

 

  • Like 1
Link to comment
5 hours ago, Miika said:

Sure,

Add this to function, which is triggered when gui opens:

Renderobjects = true

And this to function which triggers when gui closes: Renderobjects = false

Now add this on bottom of your script:


Object = createObject(--your argument here)
local ox, oy, oz = getElementPosition(Object)
Summary = 0.4 -- amount, how much your object goes upwards
  
addEventHandler("onClientRender", root,
function()
   if Renderobjects then
      local scpos = guiScrollBarGetScrollPosition(scroll)
      setElementPosition(Object, ox, oy, oz+(scpos*Summary*0.01))
   end
end
)

 

Thanks Bro ! :)

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...