Rotti Posted January 4, 2013 Posted January 4, 2013 Hello, I want to open my gui after the player went into the marker. My Serverside script: local myMarker = createMarker(-2615, 2262, 7.3, 'cylinder', 1.0, 255, 0, 0, 150) -- create myMarker function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler local elementType = getElementType( hitElement ) -- get the hit element's type triggerClientEvent(elementType, "open", getRootElement ()) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) -- attach onMarkerHit event to MarkerHit function My Clientside script: addEventHandler("onClientResourceStart",resourceRoot, function () Window = guiCreateWindow(583, 409, 197, 327, "Fake Cars", false) guiWindowSetSizable(Window, false) Faggio = guiCreateButton(9, 96, 117, 33, "Faggio", false, Window) Perennial = guiCreateButton(9, 131, 117, 35, "Perennial", false, Window) Walton = guiCreateButton(9, 169, 118, 34, "Walton", false, Window) Tampa = guiCreateButton(9, 206, 118, 34, "Tampa", false, Window) AutoWählenLabel = guiCreateLabel(30, 57, 139, 15, "Bitte wähle ein Auto aus", false, Window) Abbrechen = guiCreateButton(10, 288, 177, 29, "Abbrechen", false, Window) OderMöchtestDu = guiCreateLabel(39, 269, 117, 15, "Oder möchtest du...", false, Window) FaggioPreis = guiCreateLabel(131, 104, 52, 15, "500$", false, Window) guiLabelSetColor(FaggioPreis, 23, 132, 5) PerennialPreis = guiCreateLabel(131, 141, 53, 15, "2000$", false, Window) guiLabelSetColor(PerennialPreis, 23, 132, 5) WaltonPreis = guiCreateLabel(132, 181, 55, 15, "1500$", false, Window) guiLabelSetColor(WaltonPreis, 23, 132, 5) TampaPreis = guiCreateLabel(131, 218, 56, 15, "750$", false, Window) guiLabelSetColor(TampaPreis, 23, 132, 5) end ) function Fake_Cars_start () guiSetVisible(Window, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), Fake_Cars_start) function Fake_Cars_show() local IsWindowVisible = guiGetVisible(window) if (IsWindowVisible == true) then guiSetVisible(Window, false) guiSetInputEnabled(false) showCursor(false) end if (IsWindowVisible == false) then guiSetVisible(Window, true) guiSetInputEnabled(true) showCursor(true) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), Fake_Cars_start) function Buttons (state) if state == "left" then if source == X then Fake_Cars_show() end end end addEventHandler("onClientGUIClick", getRootElement(), Buttons) addEvent("open", true) addEventHandler("open", getRootElement (), Fake_Cars_show) But if i go into my marker the GUI doesn't open please help sorry for bad englisch.
manve1 Posted January 4, 2013 Posted January 4, 2013 SERVER: local myMarker = createMarker(-2615, 2262, 7.3, 'cylinder', 1.0, 255, 0, 0, 150) -- create myMarker function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler triggerClientEvent(hitElement, "open", hitElement) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) -- attach onMarkerHit event to MarkerHit function
manve1 Posted January 4, 2013 Posted January 4, 2013 replace: local IsWindowVisible = guiGetVisible(window) TO: local IsWindowVisible = guiGetVisible(Window)
cs8898 Posted January 4, 2013 Posted January 4, 2013 I found two times :0/:O one of them replace them to alphanumeric names i mean a-Z 1-0 Und noch in deutsch nur buchstaben groß ,klein und 1234567890;aber kein äöüß addEventHandler("onClientResourceStart",resourceRoot, function () Window = guiCreateWindow(583, 409, 197, 327, "Fake Cars", false) guiWindowSetSizable(Window, false) obutton = guiCreateButton(9, 96, 117, 33, ":O", false, Window) Perennial = guiCreateButton(9, 131, 117, 35, "Perennial", false, Window) Walton = guiCreateButton(9, 169, 118, 34, "Walton", false, Window) Tampa = guiCreateButton(9, 206, 118, 34, "Tampa", false, Window) AutoWählenLabel = guiCreateLabel(30, 57, 139, 15, "Bitte wähle ein Auto aus", false, Window) Abbrechen = guiCreateButton(10, 288, 177, 29, "Abbrechen", false, Window) OderMöchtestDu = guiCreateLabel(39, 269, 117, 15, "Oder möchtest du...", false, Window) lable1 = guiCreateLabel(131, 104, 52, 15, "500$", false, Window) guiLabelSetColor(, 23, 132, 5) PerennialPreis = guiCreateLabel(131, 141, 53, 15, "2000$", false, Window) guiLabelSetColor(PerennialPreis, 23, 132, 5) WaltonPreis = guiCreateLabel(132, 181, 55, 15, "1500$", false, Window) guiLabelSetColor(WaltonPreis, 23, 132, 5) TampaPreis = guiCreateLabel(131, 218, 56, 15, "750$", false, Window) guiLabelSetColor(TampaPreis, 23, 132, 5) end ) fl. klappts ja dann
manve1 Posted January 4, 2013 Posted January 4, 2013 I found two times :0/:O one of them replace them to alphanumeric names i mean a-Z 1-0Und noch in deutsch nur buchstaben groß ,klein und 1234567890;aber kein äöüß addEventHandler("onClientResourceStart",resourceRoot, function () Window = guiCreateWindow(583, 409, 197, 327, "Fake Cars", false) guiWindowSetSizable(Window, false) obutton = guiCreateButton(9, 96, 117, 33, ":O", false, Window) Perennial = guiCreateButton(9, 131, 117, 35, "Perennial", false, Window) Walton = guiCreateButton(9, 169, 118, 34, "Walton", false, Window) Tampa = guiCreateButton(9, 206, 118, 34, "Tampa", false, Window) AutoWählenLabel = guiCreateLabel(30, 57, 139, 15, "Bitte wähle ein Auto aus", false, Window) Abbrechen = guiCreateButton(10, 288, 177, 29, "Abbrechen", false, Window) OderMöchtestDu = guiCreateLabel(39, 269, 117, 15, "Oder möchtest du...", false, Window) lable1 = guiCreateLabel(131, 104, 52, 15, "500$", false, Window) guiLabelSetColor(, 23, 132, 5) PerennialPreis = guiCreateLabel(131, 141, 53, 15, "2000$", false, Window) guiLabelSetColor(PerennialPreis, 23, 132, 5) WaltonPreis = guiCreateLabel(132, 181, 55, 15, "1500$", false, Window) guiLabelSetColor(WaltonPreis, 23, 132, 5) TampaPreis = guiCreateLabel(131, 218, 56, 15, "750$", false, Window) guiLabelSetColor(TampaPreis, 23, 132, 5) end ) fl. klappts ja dann It makes it as ':O' because MTA doesn't allow words like F*ck
Rotti Posted January 4, 2013 Author Posted January 4, 2013 I didn't scripted the button... It isn't in my script. But its on the website Edit: Normally the Button is a "F a g g i o" Button... Edit2: This website doesn't allows the word F a g g i o
Rotti Posted January 4, 2013 Author Posted January 4, 2013 replace: local IsWindowVisible = guiGetVisible(window) TO: local IsWindowVisible = guiGetVisible(Window) what did you change?
Castillo Posted January 4, 2013 Posted January 4, 2013 He changed the lower case "w" of variable to "W" because that's the right one.
Vision Posted January 4, 2013 Posted January 4, 2013 addEventHandler("onClientResourceStart",resourceRoot, function () Window = guiCreateWindow(583, 409, 197, 327, "Fake Cars", false) guiWindowSetSizable(Window, false) obutton = guiCreateButton(9, 96, 117, 33, ":O", false, Window) Perennial = guiCreateButton(9, 131, 117, 35, "Perennial", false, Window) Walton = guiCreateButton(9, 169, 118, 34, "Walton", false, Window) Tampa = guiCreateButton(9, 206, 118, 34, "Tampa", false, Window) AutoWahlenLabel = guiCreateLabel(30, 57, 139, 15, "Bitte wähle ein Auto aus", false, Window) Abbrechen = guiCreateButton(10, 288, 177, 29, "Abbrechen", false, Window) OderMochtestDu = guiCreateLabel(39, 269, 117, 15, "Oder möchtest du...", false, Window) lable1 = guiCreateLabel(131, 104, 52, 15, "500$", false, Window) guiLabelSetColor(lable1, 23, 132, 5) PerennialPreis = guiCreateLabel(131, 141, 53, 15, "2000$", false, Window) guiLabelSetColor(PerennialPreis, 23, 132, 5) WaltonPreis = guiCreateLabel(132, 181, 55, 15, "1500$", false, Window) guiLabelSetColor(WaltonPreis, 23, 132, 5) TampaPreis = guiCreateLabel(131, 218, 56, 15, "750$", false, Window) guiLabelSetColor(TampaPreis, 23, 132, 5) end ) function Fake_Cars_start () guiSetVisible(Window, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), Fake_Cars_start) function Fake_Cars_show() local IsWindowVisible = guiGetVisible(Window) if (IsWindowVisible == true) then guiSetVisible(Window, false) guiSetInputEnabled(false) showCursor(false) end if (IsWindowVisible == false) then guiSetVisible(Window, true) guiSetInputEnabled(true) showCursor(true) end end function Buttons (state) if state == "left" then if source == X then Fake_Cars_show() end end end addEventHandler("onClientGUIClick", getRootElement(), Buttons) addEvent("open", true) addEventHandler("open", getRootElement (), Fake_Cars_show)
Rotti Posted January 4, 2013 Author Posted January 4, 2013 It doesn't work what the Hell! did you test the code?
TAPL Posted January 4, 2013 Posted January 4, 2013 -- Client Side -- Window = guiCreateWindow(583, 409, 197, 327, "Fake Cars", false) guiWindowSetSizable(Window, false) guiSetVisible(Window, false) obutton = guiCreateButton(9, 96, 117, 33, ":O", false, Window) Perennial = guiCreateButton(9, 131, 117, 35, "Perennial", false, Window) Walton = guiCreateButton(9, 169, 118, 34, "Walton", false, Window) Tampa = guiCreateButton(9, 206, 118, 34, "Tampa", false, Window) AutoWahlenLabel = guiCreateLabel(30, 57, 139, 15, "Bitte wähle ein Auto aus", false, Window) Abbrechen = guiCreateButton(10, 288, 177, 29, "Abbrechen", false, Window) OderMochtestDu = guiCreateLabel(39, 269, 117, 15, "Oder möchtest du...", false, Window) lable1 = guiCreateLabel(131, 104, 52, 15, "500$", false, Window) guiLabelSetColor(lable1, 23, 132, 5) PerennialPreis = guiCreateLabel(131, 141, 53, 15, "2000$", false, Window) guiLabelSetColor(PerennialPreis, 23, 132, 5) WaltonPreis = guiCreateLabel(132, 181, 55, 15, "1500$", false, Window) guiLabelSetColor(WaltonPreis, 23, 132, 5) TampaPreis = guiCreateLabel(131, 218, 56, 15, "750$", false, Window) guiLabelSetColor(TampaPreis, 23, 132, 5) function Fake_Cars_show() local IsWindowVisible = guiGetVisible(Window) if (IsWindowVisible == true) then guiSetVisible(Window, false) guiSetInputEnabled(false) elseif (IsWindowVisible == false) then guiSetVisible(Window, true) guiSetInputEnabled(true) end end local myMarker = createMarker(-2615, 2262, 7.3, "cylinder", 1.0, 255, 0, 0, 150) addEventHandler("onClientMarkerHit", myMarker, function(player) if getElementType(player) == "player" and player == localPlayer then Fake_Cars_show() end end) function Buttons(state) if state == "left" then if source == Abbrechen then Fake_Cars_show() end end end addEventHandler("onClientGUIClick", root, Buttons) There no need for server side.
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