Aurora Posted June 4, 2014 Share Posted June 4, 2014 Hello guys when i made a vehicle spawner in LSPD then i copied in LVPD But changed places ( x,y,z ) in client.lua when i spawn in lv it spawned double car i mean if i spawned LV Car 2 lv cars appear so what must i do to solve this? Link to comment
#Al-Ha[J]aRii Posted June 4, 2014 Share Posted June 4, 2014 Hello guyswhen i made a vehicle spawner in LSPD then i copied in LVPD But changed places ( x,y,z ) in client.lua when i spawn in lv it spawned double car i mean if i spawned LV Car 2 lv cars appear so what must i do to solve this? post your code Link to comment
Aurora Posted June 4, 2014 Author Share Posted June 4, 2014 local marker1 = createMarker( 1580.6999511719, -1609.5, 11.89999961853, "Cylinder", 2.6, 0, 75, 255, 255) local marker2 = createMarker( 1573.6999511719, -1610.3000488281, 11.89999961853, "Cylinder", 2.6, 0, 75, 255, 255) local marker3 = createMarker( 1566.9000244141, -1610.8000488281, 11.89999961853, "Cylinder", 2.6, 0, 75, 255, 255) local marker4 = createMarker( 1559.4000244141, -1610.5999755859, 11.89999961853, "Cylinder", 2.6, 0, 75, 255, 255) local marker5 = createMarker( 1595.5999755859, -1709.9000244141, 4.6999998092651, "Cylinder", 2.6, 0, 75, 255, 255) GUIEditor = { gridlist = {}, window = {}, label = {}, } GUIEditor.window[1] = guiCreateWindow(399, 131, 403, 426, "Police vehicle", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF001EFB") guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(48, 33, 289, 70, "Here you can spawn Police vehicles", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "clear-normal") guiLabelSetColor(GUIEditor.label[1], 17, 0, 252) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") GUIEditor.gridlist[1] = guiCreateGridList(30, 124, 337, 221, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "ID", 0.3) guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.7) for i = 1, 6 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "596", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "Police Car LS", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "597", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 2, "Police Car SF", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "598", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 2, 2, "Police Car LV", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "523", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 3, 2, "HPV1000", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 1, "599", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 4, 2, "Police Ranger", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 1, "415", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 5, 2, "Cheetah", false, false) spawn = guiCreateButton(16, 355, 181, 50, "Spawn", false, GUIEditor.window[1]) guiSetFont(spawn, "clear-normal") guiSetProperty(spawn, "NormalTextColour", "FF72FE00") Cancel = guiCreateButton(207, 355, 186, 54, "Cancel", false, GUIEditor.window[1]) guiSetFont(Cancel, "clear-normal") guiSetProperty(Cancel, "NormalTextColour", "FFFD0000") function vpspawner(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if getPlayerTeam(localPlayer) == getTeamFromName("Police") then if not isPedInVehicle(localPlayer) then if not guiGetVisible(GUIEditor.window[1]) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end end else exports["TopBarChat"]:sendClientMessage ("This Marker for certain job or team", 255, 255, 0 ) end end addEventHandler("onClientMarkerHit", marker1, vpspawner) addEventHandler("onClientMarkerHit", marker2, vpspawner) addEventHandler("onClientMarkerHit", marker3, vpspawner) addEventHandler("onClientMarkerHit", marker4, vpspawner) addEventHandler("onClientMarkerHit", marker5, vpspawner) function createveh() local pspawner = getLocalPlayer() local x, y, z = getElementPosition ( pspawner ) local vehicle = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if vehicle then triggerServerEvent("onSpawnVeh", localPlayer, tonumber(vehicle)) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addEventHandler("onClientGUIClick", spawn, createveh, false) function spawnclose() guiSetVisible(GUIEditor.window[1], false) showCursor(false) if (toonShader) then destroyElement(toonShader) toonShader = nil end end addEventHandler("onClientGUIClick", Cancel, spawnclose, false) i just change first places and thats happen Link to comment
Den. Posted June 4, 2014 Share Posted June 4, 2014 Use this createveh function instead: function createveh(button, state) if button == 'left' and state == 'down' then local x, y, z = getElementPosition ( localPlayer ) local vehicle = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if vehicle then triggerServerEvent("onSpawnVeh", localPlayer, tonumber(vehicle)) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end end addEventHandler("onClientGUIClick", spawn, createveh, false) onClientGUIClick is triggered for when a GUI button is clicked, and released. Hence state could be 'up' or 'down'. 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