Jump to content

Respawn vehicle by command


xXGhostXx

Recommended Posts

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
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
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...