Jump to content

[HELP]GUI window pop-ups for everybody on markerHit.


NotAvailable

Recommended Posts

Hi, im currently working on a Real-Time prison.

but i have 1 little problem.

When "Someone" enters the marker the GUI opens-up for "Everybody in-game"

How do i fix that?

I tried to fix it but none of my solutions worked.

Here's the GUI code:

local visitMarker = createMarker( -2278.9223632813, 1904.2668457031, 8.0588625335693, "Cylinder", 1, 255, 6000, 0, 140) 
local pGate = createObject(976, -2280.6494140625, 1911.068359375, 7.9688630104065, 0, 0, 270.91735839844) 
     
     
    function looool (hitElement) 
    if getElementType( hitElement ) == "player" then 
        window = guiCreateWindow(542,170,241,350,"Visitor",false) 
        guiWindowSetMovable(window,false) 
        guiWindowSetSizable(window,false) 
        label = guiCreateLabel(48,32,150,22,"What are you doing here?",false,window) 
        guiLabelSetColor(label,255,255,255) 
        guiLabelSetVerticalAlign(label,"top") 
        guiLabelSetHorizontalAlign(label,"left",false) 
        button1 = guiCreateButton(36,68,168,43,"Visiting a partner",false,window) 
        addEventHandler("onClientGUIClick", button1, opengate, false) 
        guiSetFont(button1,"default-bold-small") 
        button2 = guiCreateButton(36,121,168,43,"Visiting family",false,window) 
        addEventHandler("onClientGUIClick", button2, family, false) 
        guiSetFont(button2,"default-bold-small") 
        button3 = guiCreateButton(36,174,168,43,"Im coming to free my partner",false,window) 
        addEventHandler("onClientGUIClick", button3, free, false) 
        guiSetFont(button3,"default-small") 
        button4 = guiCreateButton(36,227,168,43,"Im trying to blow-up Alcatraz",false,window) 
        addEventHandler("onClientGUIClick", button4, blow, false) 
        guiSetFont(button4,"default-small") 
        leave = guiCreateButton(36,280,168,43,"Leave",false,window) 
        addEventHandler ( "onClientGUIClick", leave, hidewindow, false ) 
        guiSetFont(leave,"default-bold-small") 
        showCursor(true) 
    end 
    end 
    addEventHandler( "onClientMarkerHit", visitMarker, looool) 
     
     
function hidewindow(player) 
    guiSetVisible (window,false) 
    showCursor(false) 
end 
   
    function showhide(player) 
    if player == getLocalPlayer() and source == visitMarker then 
    guiSetVisible (window,true) 
    showCursor(true) 
    end 
    end 
  
function opengate() 
guardWindow = guiCreateWindow(225,40,333,134,"Guard",false) 
guiWindowSetMovable(guardWindow,false) 
guiWindowSetSizable(guardWindow,false) 
guardMemo = guiCreateMemo(16,27,304,76,"Ok, go ahead",false,guardWindow) 
guiMemoSetReadOnly(guardMemo,true) 
guardButton = guiCreateButton(109,107,121,17,"Closing in 2 seconds.",false,guardWindow) 
guiSetFont(guardButton,"default-small") 
guiSetVisible(guardWindow, true) 
guiSetVisible(window, false) 
showCursor(false) 
guiBringToFront(guardWindow) 
setTimer(gateUp, 500, 1) 
setTimer(closeGuardWindow, 2500, 1) 
setTimer(gateBack, 3000, 1) 
end 
  
function gateUp() 
moveObject(pGate, 400, -2280.6494140625, 1911.068359375, 10.81021785736) 
end 
  
function gateBack() 
moveObject(pGate, 400, -2280.6494140625, 1911.068359375, 7.9688630104065) 
end 
  
function closeGuardWindow() 
guiSetVisible(guardWindow, false) 
showCursor(false) 
end 
     
function free() 
guardWindow = guiCreateWindow(225,40,333,134,"Guard",false) 
guiWindowSetMovable(guardWindow,false) 
guiWindowSetSizable(guardWindow,false) 
guardMemo = guiCreateMemo(16,27,304,76,"Yeah, and i gotta believe that!\nYou wont get in here homeboy.\nIf you do, we will open fire at you.",false,guardWindow) 
guiMemoSetReadOnly(guardMemo,true) 
guardButton = guiCreateButton(109,107,121,17,"Close",false,guardWindow) 
addEventHandler("onClientGUIClick", guardButton, closeGuardWindow, false) 
guiSetFont(guardButton,"default-small") 
guiSetVisible(guardWindow, true) 
guiSetVisible(window, false) 
showCursor(true) 
guiBringToFront(guardWindow) 
end 
  
function family() 
guardWindow = guiCreateWindow(225,40,333,134,"Guard",false) 
guiWindowSetMovable(guardWindow,false) 
guiWindowSetSizable(guardWindow,false) 
guardMemo = guiCreateMemo(16,27,304,76,"Ok, go ahead",false,guardWindow) 
guiMemoSetReadOnly(guardMemo,true) 
guardButton = guiCreateButton(109,107,121,17,"Closing in 2 seconds.",false,guardWindow) 
guiSetFont(guardButton,"default-small") 
guiSetVisible(guardWindow, true) 
guiSetVisible(window, false) 
showCursor(false) 
guiBringToFront(guardWindow) 
setTimer(gateUp, 500, 1) 
setTimer(closeGuardWindow, 2500, 1) 
setTimer(gateBack, 3000, 1) 
end 
  
function blow() 
guardWindow = guiCreateWindow(225,40,333,134,"Guard",false) 
guiWindowSetMovable(guardWindow,false) 
guiWindowSetSizable(guardWindow,false) 
guardMemo = guiCreateMemo(16,27,304,76,"Run away, before i blow you up!",false,guardWindow) 
guiMemoSetReadOnly(guardMemo,true) 
guardButton = guiCreateButton(109,107,121,17,"Closing in 3 seconds.",false,guardWindow) 
guiSetFont(guardButton,"default-small") 
guiSetVisible(guardWindow, true) 
guiSetVisible(window, false) 
showCursor(false) 
guiBringToFront(guardWindow) 
setTimer(closeGuardWindow, 3000, 1) 
end 
  
  

Hope someone could help me.

Regards,

Jesseunit

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