Cadu12 Posted January 3, 2012 Posted January 3, 2012 I have problem with Race gamemode. It dont me let create vehicle and warpPedIntoVehicle, it will deleted when I created... I cant found some files or/and lines to edit... function onPlayAgainRequest() local veh = exports.race:getPlayerVehicle(source) local model = getVehicleModelFromName(getVehicleName(veh)) local vehicle = createVehicle(model, 4, 0, 3) setElementData(source, 'race.spectating', false) setElementData(source, 'race.playagain', true) setCameraTarget(source, source) spawnPlayer(source, 4, 0, 3) warpPedIntoVehicle(source, vehicle) end addEventHandler("onRequestRespawn", getRootElement(), onPlayAgainRequest) PS: onRequestRespawn is a custom event.
Castillo Posted January 3, 2012 Posted January 3, 2012 You mean the vehicle get's created but "race" destroys it just after?
SDK Posted January 3, 2012 Posted January 3, 2012 That's because of the way race works. You can't just create a vehicle and stuff a player in it because race uses it own system to create vehicles (it repairs them on respawn actually).
arezu Posted January 3, 2012 Posted January 3, 2012 you dont need to create a new vehicle, remove that line and change warp ped to: warpPedIntoVehicle(source, veh)
Cadu12 Posted January 3, 2012 Author Posted January 3, 2012 function onPlayAgainRequest() local veh = exports.race:getPlayerVehicle(source) setElementData(source, 'race.spectating', false) setElementData(source, 'race.playagain', true) spawnPlayer(source, 4, 0, 3) setCameraTarget(source, source) warpPedIntoVehicle(source, veh) end addEventHandler("onRequestRespawn", getRootElement(), onPlayAgainRequest) Im not sure if it'll works. untested
Recommended Posts