Jump to content

[HELP] Gui shows for all players


Recommended Posts

Well title says it.

The first GUI that shows in marker;

--------------------------||Open Source||-------------------------- 
------------------------------------------------------------------- 
  
function createHauptGUI() 
    local X = 0.3 
    local Y = 0.7 
    local Width = 0.4 
    local Height = 0.17 
    HauptGUI = guiCreateWindow(X, Y, Width, Height,"Garage Menu", true) 
     
    X = 0.5 
    Y = 0.5 
    Width = 0.45 
    Height = 0.4 
    btnmyGarages = guiCreateButton(X, Y, Width, Height, "Own Garage", true, HauptGUI) 
     
    X = 0.03 
    Y = 0.5 
    Width = 0.45 
    Height = 0.4 
    btnfreeGarages = guiCreateButton(X, Y, Width, Height, "Not Owned Garages", true, HauptGUI) 
     
    X = 0.9 
    Y = 0.3 
    Width = 0.05 
    Height = 0.15 
    btnclose = guiCreateButton(X, Y, Width, Height, "X", true, HauptGUI) 
     
     
    addEventHandler("onClientGUIClick", btnmyGarages, cmyGUI, false) 
    addEventHandler("onClientGUIClick", btnfreeGarages, cfreeGUI, false) 
    addEventHandler("onClientGUIClick", btnclose, clientHauptclose, false) 
end 
  
  
function cmyGUI() 
    guiSetVisible(HauptGUI, false) 
    triggerServerEvent ( "onmyGUI", localPlayer)     
end 
function cfreeGUI() 
    guiSetVisible(HauptGUI, false) 
    triggerServerEvent ( "onfreeGUI", localPlayer)   
end 
  
function clientHauptclose() 
    guiSetVisible(HauptGUI, false) 
    setCameraTarget ( localPlayer ) 
    setElementFrozen ( localPlayer, false ) 
    setPlayerHudComponentVisible ( "radar", true ) 
end 
  
function clientbuy(thePlayer) 
    Index, b =guiGridListGetSelectedItem ( Garagenliste ) 
    triggerServerEvent ( "buy",localPlayer, Index )  
end 
  
function cHauptGUI() 
    createHauptGUI(thePlayer) 
    setCameraMatrix(1631.8000488281, -1070.9000244141, 41, 1593, -1026, 30) 
    setElementFrozen ( localPlayer, true ) 
    setPlayerHudComponentVisible ( "radar", false )  
end 
addEvent( "onMarkerHit", true ) 
addEventHandler( "onMarkerHit" ,getRootElement(), cHauptGUI, thePlayer) 
  

If you want other GUIs just tell me in the topic.

Link to comment
  
--------------------------||Open Source||-------------------------- 
------------------------------------------------------------------- 
  
function createHauptGUI() 
    local X = 0.3 
    local Y = 0.7 
    local Width = 0.4 
    local Height = 0.17 
    HauptGUI = guiCreateWindow(X, Y, Width, Height,"Garage Menu", true) 
    
    X = 0.5 
    Y = 0.5 
    Width = 0.45 
    Height = 0.4 
    btnmyGarages = guiCreateButton(X, Y, Width, Height, "Own Garage", true, HauptGUI) 
    
    X = 0.03 
    Y = 0.5 
    Width = 0.45 
    Height = 0.4 
    btnfreeGarages = guiCreateButton(X, Y, Width, Height, "Not Owned Garages", true, HauptGUI) 
    
    X = 0.9 
    Y = 0.3 
    Width = 0.05 
    Height = 0.15 
    btnclose = guiCreateButton(X, Y, Width, Height, "X", true, HauptGUI) 
    
    
    addEventHandler("onClientGUIClick", btnmyGarages, cmyGUI, false) 
    addEventHandler("onClientGUIClick", btnfreeGarages, cfreeGUI, false) 
    addEventHandler("onClientGUIClick", btnclose, clientHauptclose, false) 
end 
  
  
function cmyGUI() 
    guiSetVisible(HauptGUI, false) 
    triggerServerEvent ( "onmyGUI", localPlayer)    
end 
function cfreeGUI() 
    guiSetVisible(HauptGUI, false) 
    triggerServerEvent ( "onfreeGUI", localPlayer)  
end 
  
function clientHauptclose() 
    guiSetVisible(HauptGUI, false) 
    setCameraTarget ( localPlayer ) 
    setElementFrozen ( localPlayer, false ) 
    setPlayerHudComponentVisible ( "radar", true ) 
end 
  
function clientbuy(thePlayer) 
    Index, b =guiGridListGetSelectedItem ( Garagenliste ) 
    triggerServerEvent ( "buy",localPlayer, Index ) 
end 
  
function cHauptGUI(thePlayer) 
   if not thePlayer then 
   local thePlayer = localPlayer 
end 
    createHauptGUI(thePlayer) 
    setCameraMatrix(1631.8000488281, -1070.9000244141, 41, 1593, -1026, 30) 
    setElementFrozen ( thePlayer, true ) 
    setPlayerHudComponentVisible ( "radar", false ) 
end 
addEvent( "onMarkerHit", true ) 
addEventHandler( "onMarkerHit" , resourceRoot, cHauptGUI) 
  
  

Link to comment

@ Anubhav You'r Code is Worng ,

local X = 0.3 
    local Y = 0.7 
    local Width = 0.4 
    local Height = 0.17 
    HauptGUI = guiCreateWindow(X, Y, Width, Height,"Garage Menu", true) 
    X = 0.5 
    Y = 0.5 
    Width = 0.45 
    Height = 0.4 
    btnmyGarages = guiCreateButton(X, Y, Width, Height, "Own Garage", true, HauptGUI) 
    X = 0.03 
    Y = 0.5 
    Width = 0.45 
    Height = 0.4 
    btnfreeGarages = guiCreateButton(X, Y, Width, Height, "Not Owned Garages", true, HauptGUI) 
    X = 0.9 
    Y = 0.3 
    Width = 0.05 
    Height = 0.15 
    btnclose = guiCreateButton(X, Y, Width, Height, "X", true, HauptGUI) 
    guiSetVisible(HauptGUI, false) 
     
    addEventHandler ( 'onClinetGUIClick', resourceRoot, 
    function ( ) 
    if ( source == btnfreeGarages ) then 
    triggerServerEvent ( 'onfreeGUI', localPlayer ) 
    guiSetVisible(HauptGUI, false) 
    elseif ( source == btnmyGarages ) then 
    triggerServerEvent ( 'onmyGUI', localPlayer ) 
    guiSetVisible(HauptGUI, false)  
    elseif ( source == btnclose ) then 
    guiSetVisible(HauptGUI, false) 
    setCameraTarget ( localPlayer ) 
    setElementFrozen ( localPlayer, false ) 
    setPlayerHudComponentVisible ( "radar", true ) 
    end 
 end 
 ) 
  
 addEventHandler( "onClientMarkerHit" ,resourceRoot, 
 function ( hitElement ) 
         if ( getElementType ( hitElement ) == 'player' ) then 
         guiSetVisible(HauptGUI, true)  
         setCameraMatrix(1631.8000488281, -1070.9000244141, 41, 1593, -1026, 30) 
         setElementFrozen ( localPlayer, true ) 
         setPlayerHudComponentVisible ( "radar", false )  
         end 
     end 
 ) 

Also , i didn't fix this ,

function clientbuy(thePlayer) 
    Index, b =guiGridListGetSelectedItem ( Garagenliste ) 
    triggerServerEvent ( "buy",localPlayer, Index ) 
end 

because i dont know how you call this function .

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