addCommandHandler( "darveiculo",
function (playerSource, cmdName, ID)
local px, py = getElementPosition(playerSource)
local vehName = getVehicleNameFromModel(ID)
if ID and type(vehName) ~= "string" then
return outputChatBox("O ID do veículo é inválido", playerSource, 225, 0, 0)
elseif not ID then
return outputChatBox("Sintaxe: /darveiculo ID", playerSource, 225, 0, 0)
end
for _,Pl in ipairs(getElementsByType("player")) do
local x, y, z = getElementPosition(Pl)
local Distance = getDistanceBetweenPoints2D(px, py, x, y)
if (Distance <= 30) then
outputChatBox("Você ganhou o veículo "..vehName, Pl, 0, 255, 0)
local veiculo = createVehicle( ID, x, y, z )
warpPedIntoVehicle (Pl, veiculo )
end
end
end
)