Andrew75t Posted August 19, 2020 Share Posted August 19, 2020 I created a gui, it opens when the player logs into the server. How do I make the window open when the player steps on the marker? Client function createWSWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 WSWindow = guiCreateWindow(X, Y, Width, Height, "WEAPONSHOP", true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createWSWindow() end ) function createWSWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 WSWindow = guiCreateWindow(X, Y, Width, Height, "WEAPONSHOP", true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createWSWindow() end ) Server local WeaponShopMarker = createMarker(1790.7, -1699.3, 12.6, "cylinder", 2.5, 0, 0, 0, 50) addEventHandler("onMarkerHit", WeaponShopMarker, function(ThePlayer) addPedClothes ( ThePlayer, "tshirtzipcrm", "tshirt", 0 ) end) Link to comment
Trust aka Tiffergan Posted August 19, 2020 Share Posted August 19, 2020 (edited) client local window1 = guiCreateWindow(0.22, 0.22, 0.57, 0.61, "bla", true) guiWindowSetSizable(window1, false) guiSetVisible(window1,false) local button1 = guiCreateButton(0.03, 0.83, 0.94, 0.15, "123", true, window1) local text1 = guiCreateLabel(0.03, 0.07, 0.94, 0.75, "321", true, window1) guiLabelSetHorizontalAlign(text1, "center", false) addEvent("showGUI",true) addEventHandler("showGUI",getRootElement(), function () if ( guiGetVisible(window1) == false ) then guiSetVisible(window1,true) showCursor(true) end end) local function guzik() guiSetVisible(window1, false) showCursor(false, false) end addEventHandler("onClientGUIClick", button1, guzik, false) server addEventHandler("onResourceStart",resourceRoot, function () local marker = createMarker(1542.67529, -1448.50500, 12.54688, "cylinder", 1.5, 0, 255, 0, 180) -- USE YOUR OWN X/Y/Z --local blip = createBlipAttachedTo(marker, 1) -- pokazuje naam marker na gps i mapie setElementInterior(marker, 0) setElementDimension(marker, 0) addEventHandler("onMarkerHit",marker,onMarkerHit) end) function onMarkerHit(hitPlayer, matchingDimension) if not matchingDimension then return end if ( getElementType (hitPlayer) == 'player' ) then triggerClientEvent(hitPlayer,"showGUI",hitPlayer) end end just change X/Y/Z and shloud working @Andrew75t Edited August 19, 2020 by LOOah Link to comment
Andrew75t Posted August 20, 2020 Author Share Posted August 20, 2020 (edited) Thanks, you are helped me a lot. Edited August 20, 2020 by Andrew75t Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now