battle309 Posted September 22, 2012 Share Posted September 22, 2012 (edited) Hey, i want a random car on respawn but I get bad argue ments on warp ped for example i drive off a cliff into the water my cars blows up and I respawn with a new vehicle function onSpawn() local randomveh = ({411, 602, 496, 491})[math.random(4)] local veh = createVehicle (randomveh, 0, 0, 3) warpPedIntoVehicle (source) end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) Edited September 22, 2012 by Guest Link to comment
Castillo Posted September 22, 2012 Share Posted September 22, 2012 function onSpawn ( ) local vehicles = { 411, 602, 496, 491 } local veh = createVehicle ( vehicles [ math.random ( #vehicles ) ], 0, 0, 3 ) warpPedIntoVehicle ( source, veh ) end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) Link to comment
Kenix Posted September 22, 2012 Share Posted September 22, 2012 Hey, i want a random car on respawn but I get bad argue ments on warp pedfor example i drive off a cliff into the water my cars blows up and I respawn with a new vehicle function onSpawn() local randomveh = ({411, 602, 496, 491})[math.random(4)] local veh = createVehicle (randomveh, 0, 0, 3) warpPedIntoVehicle (source) end addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) 2 argument in function warpPedIntoVehicle should be vehicle. 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