Chronos Posted April 28, 2013 Share Posted April 28, 2013 well i need script to creat vehicle spawn marker for 4 vehicle ( hydra-hunter-rustler-shamal) in this location: x:305.371582 y:1812.62744 z:17.640625 Link to comment
iPrestege Posted April 28, 2013 Share Posted April 28, 2013 You want a script when you hit a Marker you will get a math.random vehicles from that vehicles you said? Link to comment
iPrestege Posted April 28, 2013 Share Posted April 28, 2013 Will you have to create a gui panel with gui buttons ..etc and use these function's ; createMarker "onClientMarkerHit" guiSetVisible showCursor guiGridListSetItemText guiGridListAddRow "onClientGUIClick" triggerClientEvent guiGridListGetItemText guiGridListGetSelectedItem -- server getVehicleIDFromName createVehicle Link to comment
Chronos Posted April 28, 2013 Author Share Posted April 28, 2013 i use this but dosn't work for me client function openVehicleSpawnClient() local screenwidth, screenheight = guiGetScreenSize() local windowWidth, windowheight = 233, 104 local left = screenwidth/2 - windowwidth/2 local top = screenheight/2 - windowheight/2 showCursor(true) vehSpawnWin = guiCreateWindow(left, top, windowWidth, windowHeight, "Vehicle Spawner", false) guiWindowSetSizable(vehSpawnWin, false) sampleLabel = guiCreateLabel (15, 25, 201, 20, "Sample Vehicle Spawner", false, vehSpawnWin) guiLabelSetHorizonatlAlign(sampleLabel, "center", false) guiLabelSetVerticalAlign(sampleLabel, "center") 520 =guiCreateEdit(14, 75, 211, 23,"", false, vehSpawnWin) guiEditSetMaxLength(520, 32767) spawnBtn = guiCreateButton(14, 75, 211, 23, "Spawn Vehicle", false, vehSpawnWin) addEventHandler("onClientGuiClick", spawnBtn, spawnVehicleClient, false) end addEvent("openVehicleSpawn",true) addEventHandler("openVehicleSpawn",localPlayer,openVehicleSpawnClient) function spawnVehicleClient() local id = guiGetText(520) triggerServerEvent("spawnVehicleServer",localPlayer,id) showCursor(false) guiSetVisible(vehSpawnWin,false) end server local vehMark = createMarker(305.371582,1812.62744,17.640625,"cylinder") function openVehicleSpawnServer(hitElement,matchingDimension) if getPedOccupiedVehicle(hitElement) == false then triggerClientEvent(hitElement,"openVehicleSpawn"hitElement) return true end end addEventHandler("onMarkerHit",vehMark,openVehicleSpawnServer) function spawnVehicleServer(id) local x,y,z = getElementPosition(source) local myVeh = createVehicle(id,x+5,y,z) if id == "" then outputChatBox("error:you did not input any value.",source,255,0,0,true) trggerClientEvent(source,"openVehicleSpawn",source) return false end if myVeh then warpPedIntoVehicle(source,myveh) outputChatBox("you have spawned a "hydra (520) " and have been warped into it",(source,"openvehicleSpawn",source) else outputChatBox("ERROR: The requested ID does not exist.",source,255,0,0,true) triggerClientEvent(source,"openVehicleSpawn",source) end end addEvent("spawnVehicleServer",true) addEventHandler("spawnVehicleServer",root,spawnVehicleServer) Link to comment
iPrestege Posted April 28, 2013 Share Posted April 28, 2013 Try this : -- Server Side -- local vehMark = createMarker(305.371582,1812.62744,17.640625, "cylinder",2, 255, 0, 0, 170) function openVehicleSpawnServer(hitElement,matchingDimension) if not isPedInVehicle(hitElement) then triggerClientEvent(hitElement,"openVehicleSpawn",hitElement) end end addEventHandler("onMarkerHit",vehMark,openVehicleSpawnServer) function spawnVehicleServer(id) local x,y,z = getElementPosition(source) local myVeh = createVehicle(id,x+5,y,z) if id == "" then outputChatBox("error:you did not input any value.",source,255,0,0,true) triggerClientEvent(source,"openVehicleSpawn",source) return false end if myVeh then warpPedIntoVehicle(source,myVeh) outputChatBox("you have spawned and have been warped into ("..getVehicleNameFromID(id)..") it",source) else outputChatBox("ERROR: The requested ID does not exist.",source,255,0,0,true) triggerClientEvent(source,"openVehicleSpawn",source) end end addEvent("spawnVehicleServer",true) addEventHandler("spawnVehicleServer",root,spawnVehicleServer) -- Client Side -- function openVehicleSpawnClient() local screenwidth, screenheight = guiGetScreenSize() local windowWidth, windowheight = 233, 104 local left = windowWidth/2 - windowWidth/2 local top = screenheight/2 - windowheight/2 showCursor(true) vehSpawnWin = guiCreateWindow(left, top, windowWidth, windowheight, "Vehicle Spawner",false) guiWindowSetSizable(vehSpawnWin, false) sampleLabel = guiCreateLabel (15, 25, 201, 20, "Sample Vehicle Spawner", false,vehSpawnWin) guiLabelSetVerticalAlign(sampleLabel, "center") box = guiCreateEdit(0.07, 0.43, 0.82, 0.22,"", true, vehSpawnWin) guiEditSetMaxLength(box,3) spawnBtn = guiCreateButton(14, 75, 211, 23, "Spawn Vehicle", false, vehSpawnWin) addEventHandler("onClientGUIClick",spawnBtn,spawnVehicleClient) end addEvent("openVehicleSpawn",true) addEventHandler("openVehicleSpawn",localPlayer,openVehicleSpawnClient) function spawnVehicleClient() local id = guiGetText(box) triggerServerEvent("spawnVehicleServer",localPlayer,id) showCursor(false) guiSetVisible(vehSpawnWin,false) end < > 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