Announcement

Collapse
No announcement yet.

Code Snippets

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Code Snippets

    - A simple command who allow you to remove a near car.
    -- > Server Side

    Code:
    local function DestroyNearCar(player)
        local xP, yP, zP = GetPlayerLocation(player)
        for k,v in pairs(GetAllVehicles()) do
            local xV, yV, zV = GetVehicleLocation(v)
            local dist = GetDistance3D(xP, yP, zP, xV, yV, zV)
            if dist < 300.0 then --Should be better
                DestroyVehicle(v)
            end
        end
    end
    AddCommand("del", DestroyNearCar)

    #2
    Very nice, here's mine to be used with OnSetRP.

    HTML Code:
    AddCommand("vehdelete", function(player, vehicle)
    if tonumber (PlayerData[player].admin) == 1 then
         local vehicle = GetNearestCar(player)
        DestroyVehicle(vehicle)
            end
    end)

    Comment

    Working...
    X