kewiiNNN Posted February 10, 2015 Share Posted February 10, 2015 how to make a marker and when you go in the marker it will spawn you any random cars in fast cars in f1 create section? and when the vehicle its empty it will be destroyed like vanish in 2 min Link to comment
BlueTheFurry Posted February 10, 2015 Share Posted February 10, 2015 Create the marker, a Table with the cars, start an timer when it was created example table: local cars = { {411}, {410}, {412} } Link to comment
kewiiNNN Posted February 10, 2015 Author Share Posted February 10, 2015 can you paste me the whole example cause i dont know anything about scripting ? Link to comment
BlueTheFurry Posted February 10, 2015 Share Posted February 10, 2015 local cars = { {411}, {410}, {412} } carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) function carmarkerhit(hitElement) if(isElement(hitElement) and getElementType(hitElement) == "player")then randomcar = math.random(#cars) carid = cars[randomcar][1] car = createVehicle( carid, x,y,z ) warpPedintoVehicle( hitElement ) setTimer( function() destroyElement( car ) end, 120000, 1 end end addEventHandler("onMarkerHit", carmarker, carmarkerhit ) didnt test if it works, you also have to replace the coordinates to your's Link to comment
kewiiNNN Posted February 10, 2015 Author Share Posted February 10, 2015 i just replaced coordinates and it will work? Link to comment
BlueTheFurry Posted February 10, 2015 Share Posted February 10, 2015 you need to replace carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) from x,y,z to your coordinates and also car = createVehicle( carid, x,y,z ) x,y,z to the coordinates where the car should spawn Link to comment
kewiiNNN Posted February 10, 2015 Author Share Posted February 10, 2015 not working ... Link to comment
Ryancit2 Posted February 10, 2015 Share Posted February 10, 2015 Fixed @BlueTheFurry's code: local cars = { {411}, {410}, {412} } carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) function carmarkerhit(hitElement) if (isElement(hitElement) and getElementType(hitElement) == "player") then randomcar = math.random(#cars) carid = cars[randomcar][1] car = createVehicle(carid, x,y,z) warpPedintoVehicle(hitElement) setTimer(function() destroyElement(car) end, 120000, 1) end end addEventHandler("onMarkerHit", carmarker, carmarkerhit) Link to comment
kewiiNNN Posted February 10, 2015 Author Share Posted February 10, 2015 ERROR: MarkerCarspawn\login.lua:14: attempt to call global ' warpPedintoVehicle' (a nil value) now it wont warp in the car:s Link to comment
Tomas Posted February 10, 2015 Share Posted February 10, 2015 local cars = { {411}, {410}, {412} } carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) function carmarkerhit(hitElement) if (isElement(hitElement) and getElementType(hitElement) == "player") then randomcar = math.random(#cars) carid = cars[randomcar][1] car = createVehicle(carid, x,y,z) warpPedIntoVehicle(hitElement,car) setTimer(function() destroyElement(car) end, 120000, 1) end end addEventHandler("onMarkerHit", carmarker, carmarkerhit) Link to comment
novo Posted February 10, 2015 Share Posted February 10, 2015 That's because i is lowercase and it's supposed to be upper (warpPedIntoVehicle), as Lua is not case-sensitive. Link to comment
kewiiNNN Posted February 10, 2015 Author Share Posted February 10, 2015 all working but is there a way to add so while you driving you cant spawn a new vehicle? only while walking local cars = { {429}, {402}, {541}, {415}, {480}, {562}, {587}, {565}, {411}, {559}, {603}, {560}, {506}, {451}, {558}, {555}, {477} } carmarker = createMarker( -1316.7326660156,-29.210359573364,13.2, "cylinder", 2, 255, 0, 0, 210, root ) function carmarkerhit(hitElement) if (isElement(hitElement) and getElementType(hitElement) == "player") then randomcar = math.random(#cars) carid = cars[randomcar][1] car = createVehicle(carid, -1329.3344726563,-37.078189849854,14.1484375) warpPedIntoVehicle(hitElement,car) setTimer(function() destroyElement(car) end, 120000, 1) end end addEventHandler("onMarkerHit", carmarker, carmarkerhit) Link to comment
Ryancit2 Posted February 10, 2015 Share Posted February 10, 2015 Add this before or after Line#25: if (isPedInVehicle(hitElement)) then return 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