Não testei mas penso que de certo.
Alterei também a coordenadas de onde o veiculo vai cair. (penso que também de certo).
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+2, y+2, z+1 )
warpPedIntoVehicle (playerSource, veiculo )
end
end
end
)