mint3d Posted December 14, 2013 Share Posted December 14, 2013 Ok I made a car spawner script but I need help I want to be able to press F4 and it opens a GUI so I can make the marker in game and the cars I want in the marker like this one here here is my script Client Wnd = guiCreateWindow(550,100,382,450,"Vehicle System",false) guiSetAlpha( Wnd, 1 ) guiWindowSetMovable(Wnd,true) guiWindowSetSizable(Wnd,false) button = guiCreateButton(36,400,110,47,"Exit",false,Wnd) button2 = guiCreateButton(249,400,110,47,"Spawn",false,Wnd) label2 = guiCreateLabel(127,47,242,15,'',false,Wnd) label = guiCreateLabel(127,34,242,15,"Click on the vehicle you want",false,Wnd) guiLabelSetVerticalAlign(label2,"center") guiLabelSetHorizontalAlign(label2,"center",false) showCursor(false) guiSetVisible( Wnd, false ) vehicles = { {"Bmx", 481},{"Mountain Bike", 510},{"Faggio", 462},--formet "carname", "carid" } grid = guiCreateGridList(36,78,300,300,false,Wnd) guiGridListAddColumn(grid, "Vehicles", 0.85) for i,veh in ipairs(vehicles) do row = guiGridListAddRow(grid) -- guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(veh[2])) end function use2() local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then --takePlayerMoney (thePlayer, 1000) --takePlayerMoney (player, 1000) triggerServerEvent("CreVehice", localPlayer, model) end end end addEventHandler("onClientGUIClick", button2, use2, false) function close2() if (source == button2) then --takePlayerMoney (localPlayer, 1000) guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button2, close2) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) function showGUI2(hitElement) guiSetVisible(Wnd,true) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then showCursor(true) end end addEvent("showGUI2",true) addEventHandler("showGUI2", getRootElement(), showGUI2) server t = createMarker( 2030.01,1545.35,9.5, "cylinder", 2, 0, 100, 255, 100 ) f = createMarker( 2482.7263183594,-1686.0427246094,12.8, "cylinder", 2, 0, 100, 255, 100 ) g = createMarker( 2001.3251953125,-1444,12.8, "cylinder", 2, 0, 100, 255, 100 ) h = createMarker( 1184.890625,-1319,12.8, "cylinder", 2, 0, 100, 255, 100 ) j = createMarker( 1624.0262451172,1818,9.6, "cylinder", 2, 0, 100, 255, 100 ) k = createMarker( 1701.2663574219,1439,9.6, "cylinder", 2, 0, 100, 255, 100 ) l = createMarker( -2662.2287597656,600,12.8, "cylinder", 2, 0, 100, 255, 100 ) m = createMarker( -2204.9958496094,1694,7.2, "cylinder", 2, 0, 100, 255, 100 ) local vehicles = {} function spawnVeh(id) local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x + 3, y, z) warpPedIntoVehicle ( source, vehicles[source] ) end addEvent("CreVehice",true) addEventHandler("CreVehice", root, spawnVeh) addEventHandler("onPlayerQuit", root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI(hitPlayer) if source == f or source == t or source == g or source == h or source == j or source == k or source == l or source == m then triggerClientEvent (hitPlayer,"showGUI2",getRootElement(),hitPlayer) end end addEventHandler("onMarkerHit",root,showGUI) Link to comment
Snow-Man Posted December 15, 2013 Share Posted December 15, 2013 use bindKey to Open Gui https://wiki.multitheftauto.com/wiki/BindKey ( Client side ) second use table Markers local Markers ={ {2030.01,1545.35,9.5}, {2482.7263183594,-1686.0427246094,12.8}, {2001.3251953125,-1444,12.8}, {1184.890625,-1319,12.8}, {1624.0262451172,1818,9.6}, {1701.2663574219,1439,9.6}, {-2662.2287597656,600,12.8}, {-2204.9958496094,1694,7.2}, } Link to comment
behzatche0 Posted August 10, 2022 Share Posted August 10, 2022 On 14/12/2013 at 17:00, mint3d said: Ok I made a car spawner script but I need help I want to be able to press F4 and it opens a GUI so I can make the marker in game and the cars I want in the marker like this one here http://i.imgur.com/yEcAE7C.png here is my script Client Wnd = guiCreateWindow(550,100,382,450,"Vehicle System",false) guiSetAlpha( Wnd, 1 ) guiWindowSetMovable(Wnd,true) guiWindowSetSizable(Wnd,false) button = guiCreateButton(36,400,110,47,"Exit",false,Wnd) button2 = guiCreateButton(249,400,110,47,"Spawn",false,Wnd) label2 = guiCreateLabel(127,47,242,15,'',false,Wnd) label = guiCreateLabel(127,34,242,15,"Click on the vehicle you want",false,Wnd) guiLabelSetVerticalAlign(label2,"center") guiLabelSetHorizontalAlign(label2,"center",false) showCursor(false) guiSetVisible( Wnd, false ) vehicles = { {"Bmx", 481},{"Mountain Bike", 510},{"Faggio", 462},--formet "carname", "carid" } grid = guiCreateGridList(36,78,300,300,false,Wnd) guiGridListAddColumn(grid, "Vehicles", 0.85) for i,veh in ipairs(vehicles) do row = guiGridListAddRow(grid) -- guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(veh[2])) end function use2() local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then --takePlayerMoney (thePlayer, 1000) --takePlayerMoney (player, 1000) triggerServerEvent("CreVehice", localPlayer, model) end end end addEventHandler("onClientGUIClick", button2, use2, false) function close2() if (source == button2) then --takePlayerMoney (localPlayer, 1000) guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button2, close2) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) function showGUI2(hitElement) guiSetVisible(Wnd,true) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then showCursor(true) end end addEvent("showGUI2",true) addEventHandler("showGUI2", getRootElement(), showGUI2) server t = createMarker( 2030.01,1545.35,9.5, "cylinder", 2, 0, 100, 255, 100 ) f = createMarker( 2482.7263183594,-1686.0427246094,12.8, "cylinder", 2, 0, 100, 255, 100 ) g = createMarker( 2001.3251953125,-1444,12.8, "cylinder", 2, 0, 100, 255, 100 ) h = createMarker( 1184.890625,-1319,12.8, "cylinder", 2, 0, 100, 255, 100 ) j = createMarker( 1624.0262451172,1818,9.6, "cylinder", 2, 0, 100, 255, 100 ) k = createMarker( 1701.2663574219,1439,9.6, "cylinder", 2, 0, 100, 255, 100 ) l = createMarker( -2662.2287597656,600,12.8, "cylinder", 2, 0, 100, 255, 100 ) m = createMarker( -2204.9958496094,1694,7.2, "cylinder", 2, 0, 100, 255, 100 ) local vehicles = {} function spawnVeh(id) local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x + 3, y, z) warpPedIntoVehicle ( source, vehicles[source] ) end addEvent("CreVehice",true) addEventHandler("CreVehice", root, spawnVeh) addEventHandler("onPlayerQuit", root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI(hitPlayer) if source == f or source == t or source == g or source == h or source == j or source == k or source == l or source == m then triggerClientEvent (hitPlayer,"showGUI2",getRootElement(),hitPlayer) end end addEventHandler("onMarkerHit",root,showGUI) hi where is zip? 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