Jump to content

GUI troubles,help needed


Alen141

Recommended Posts

So I was working on my Job GUI, and I finished GUI fully ( from buttons to setting team, closing, opening ) but my problem is that gui shows when resource start and not only on marker hit :

script_c [client_side] :

jobWnd = guiCreateWindow(422, 250, 511, 272, "Job GUI v0.1", false) 
guiWindowSetSizable(jobWnd, false) 
  
desc = guiCreateMemo(9, 20, 492, 117, "Description: ....", false, jobWnd) 
guiMemoSetReadOnly(desc, true) 
yesbtn = guiCreateButton(64, 215, 156, 47, "Take Job", false, jobWnd) 
nobtn = guiCreateButton(266, 215, 156, 47, "Cancel", false, jobWnd) 
quitbtn = guiCreateButton(168, 147, 156, 47, "Quit Job", false, jobWnd) 
  
  
local jobmarker = createMarker ( -694.44318, 971.71588, 12.26492, "cylinder", 1.5, 255, 255, 0, 170 ) 
function SAPDjob(hitElement) 
             if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(jobWnd) then 
                       guiSetVisible(jobWnd, true) 
                       showCursor(true) 
                  end 
             end 
        end 
addEventHandler("onClientMarkerHit", jobmarker, SAPDjob) 
  
  
function closeGUI() 
    if (source == nobtn) then 
        showCursor(false) 
        guiSetVisible( jobWnd, false ) 
    end 
end 
addEventHandler("onClientGUIClick",root,closeGUI) 
  
function takeJob() 
    if ( source == yesbtn ) then             
        triggerServerEvent("getJob", getLocalPlayer()) 
        guiSetVisible(jobWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,takeJob) 
  
function quitJob() 
    if ( source == quitbtn ) then             
        triggerServerEvent("quitJob", getLocalPlayer()) 
        guiSetVisible(jobWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,quitJob) 

Link to comment
jobWnd = guiCreateWindow(422, 250, 511, 272, "Job GUI v0.1", false) 
guiWindowSetSizable(jobWnd, false) 
  
desc = guiCreateMemo(9, 20, 492, 117, "Description: ....", false, jobWnd) 
guiMemoSetReadOnly(desc, true) 
yesbtn = guiCreateButton(64, 215, 156, 47, "Take Job", false, jobWnd) 
nobtn = guiCreateButton(266, 215, 156, 47, "Cancel", false, jobWnd) 
quitbtn = guiCreateButton(168, 147, 156, 47, "Quit Job", false, jobWnd) 
guiSetVisible(jobWnd, false)--this you need 
  
  
local jobmarker = createMarker ( -694.44318, 971.71588, 12.26492, "cylinder", 1.5, 255, 255, 0, 170 ) 
function SAPDjob(hitElement) 
             if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(jobWnd) then 
                       guiSetVisible(jobWnd, true) 
                       showCursor(true) 
                  end 
             end 
        end 
addEventHandler("onClientMarkerHit", jobmarker, SAPDjob) 
  
  
function closeGUI() 
    if (source == nobtn) then 
        showCursor(false) 
        guiSetVisible( jobWnd, false ) 
    end 
end 
addEventHandler("onClientGUIClick",root,closeGUI) 
  
function takeJob() 
    if ( source == yesbtn ) then             
        triggerServerEvent("getJob", getLocalPlayer()) 
        guiSetVisible(jobWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,takeJob) 
  
function quitJob() 
    if ( source == quitbtn ) then             
        triggerServerEvent("quitJob", getLocalPlayer()) 
        guiSetVisible(jobWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,quitJob) 

Link to comment
jobWnd = guiCreateWindow(422, 250, 511, 272, "Job GUI v0.1", false) 
guiWindowSetSizable(jobWnd, false) 
  
desc = guiCreateMemo(9, 20, 492, 117, "Description: ....", false, jobWnd) 
guiMemoSetReadOnly(desc, true) 
yesbtn = guiCreateButton(64, 215, 156, 47, "Take Job", false, jobWnd) 
nobtn = guiCreateButton(266, 215, 156, 47, "Cancel", false, jobWnd) 
quitbtn = guiCreateButton(168, 147, 156, 47, "Quit Job", false, jobWnd) 
guiSetVisible(jobWnd, false)--this you need 
  
  
local jobmarker = createMarker ( -694.44318, 971.71588, 12.26492, "cylinder", 1.5, 255, 255, 0, 170 ) 
function SAPDjob(hitElement) 
             if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(jobWnd) then 
                       guiSetVisible(jobWnd, true) 
                       showCursor(true) 
                  end 
             end 
        end 
addEventHandler("onClientMarkerHit", jobmarker, SAPDjob) 
  
  
function closeGUI() 
    if (source == nobtn) then 
        showCursor(false) 
        guiSetVisible( jobWnd, false ) 
    end 
end 
addEventHandler("onClientGUIClick",root,closeGUI) 
  
function takeJob() 
    if ( source == yesbtn ) then             
        triggerServerEvent("getJob", getLocalPlayer()) 
        guiSetVisible(jobWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,takeJob) 
  
function quitJob() 
    if ( source == quitbtn ) then             
        triggerServerEvent("quitJob", getLocalPlayer()) 
        guiSetVisible(jobWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,quitJob) 

thanks :D, completely forgot to put that line

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