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. Ingame nick: Cadu12
Castillo Posted January 3, 2012 Posted January 3, 2012 You mean the vehicle get's created but "race" destroys it just after? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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). Learn Lua - Learn to script - GUI scripting Scripter tools - Find/fix errors yourself(!) Don't pm me for scripting help, keep it for the Scripting subforum!
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 Ingame nick: Cadu12
Recommended Posts