xXGhostXx Posted October 9, 2018 Share Posted October 9, 2018 Hi guys . How to make script for respawn vehicle by command ! Link to comment
LyricalMM Posted October 9, 2018 Share Posted October 9, 2018 you can't just make a default respawn vehicle, that depends on you vehicle resource but you can make it with getElementPosition --You can park it getElementData setElementPosition setElementData Link to comment
Z4Zy Posted October 10, 2018 Share Posted October 10, 2018 As @LyricalMM said, you can create a vehicle, and set a data to it that change when player enter the vehicle or when the vehicle get destroyed or something else. then you can use addCommandHandler function to add a command to respawn the vehicle if vehicle's data has changed. Link to comment
SaNoR Posted October 11, 2018 Share Posted October 11, 2018 addCommandHandler("createvehicle", function(player, cmd, id, numberplate) if isElement(player) and id then local matrix = getElementMatrix(player) local x = 3 * matrix[1][1] + 0 * matrix[2][1] - 0 * matrix[3][1] + matrix[4][1] local y = 3 * matrix[1][2] + 0 * matrix[2][2] - 0 * matrix[3][2] + matrix[4][2] local z = 3 * matrix[1][3] + 0 * matrix[2][3] - 0 * matrix[3][3] + matrix[4][3] local rX, rY, rZ = getElementRotation(player) local vehicle = createVehicle(id, x, y, z, rX, rY, rZ, numberplate) if isElement(vehicle) then outputChatBox("You have created a "..getVehicleNameFromModel(id), player, 0, 255, 0) else outputChatBox("Wrong id", player, 255, 0, 0) end else outputChatBox("/createvehicle [id] [numberplate] (createvehicle 415 X001UY)", player, 255, 0, 0) end end) Link to comment
xXGhostXx Posted October 11, 2018 Author Share Posted October 11, 2018 9 hours ago, SaNoR said: addCommandHandler("createvehicle", function(player, cmd, id, numberplate) if isElement(player) and id then local matrix = getElementMatrix(player) local x = 3 * matrix[1][1] + 0 * matrix[2][1] - 0 * matrix[3][1] + matrix[4][1] local y = 3 * matrix[1][2] + 0 * matrix[2][2] - 0 * matrix[3][2] + matrix[4][2] local z = 3 * matrix[1][3] + 0 * matrix[2][3] - 0 * matrix[3][3] + matrix[4][3] local rX, rY, rZ = getElementRotation(player) local vehicle = createVehicle(id, x, y, z, rX, rY, rZ, numberplate) if isElement(vehicle) then outputChatBox("You have created a "..getVehicleNameFromModel(id), player, 0, 255, 0) else outputChatBox("Wrong id", player, 255, 0, 0) end else outputChatBox("/createvehicle [id] [numberplate] (createvehicle 415 X001UY)", player, 255, 0, 0) end end) Create vehicle no ! I want respawn vehicle element data "faction" "car" Link to comment
Recommended Posts