function SCMF(...)
if sampAddChatMessage then
sampAddChatMessage(string.format('{696969}[vagis]:{FFFFFF} %s', string.format(...)), -1)
else
print("Error: 'sampAddChatMessage' is not available.")
end
end
local FONT = nil
local STATE = true
function main()
if not (sampRegisterChatCommand and renderCreateFont and getAllVehicles) then
print("Error: SA-MP API functions are not available.")
return
end
FONT = renderCreateFont('Arial', 9, 4)
sampRegisterChatCommand('vagis', function()
STATE = not STATE
SCMF(STATE and 'Enabled' or 'Disabled')
end)
while true do
wait(0)
if STATE then
for _, handle in pairs(getAllVehicles()) do
local result, vehicleId = sampGetVehicleIdByCarHandle(handle)
if result then
local PLAYER_POS = {getCharCoordinates(PLAYER_PED)}
local CAR_POS = {getCarCoordinates(handle)}
if isPointOnScreen(CAR_POS[1], CAR_POS[2], CAR_POS[3], 2) then
local DISTANCE = getDistanceBetweenCoords3d(CAR_POS[1], CAR_POS[2], CAR_POS[3], PLAYER_POS[1], PLAYER_POS[2], PLAYER_POS[3])
local sX, sY = convert3DCoordsToScreen(CAR_POS[1], CAR_POS[2], CAR_POS[3])
local asX, asY = convert3DCoordsToScreen(PLAYER_POS[1], PLAYER_POS[2], PLAYER_POS[3])