Jump to content

Delete vehicle from x,y,z


dewu

Recommended Posts

Hi guys. I want to delete some vehicles from different positions. So i make that script:

  
skasuj = { 
["usun"] = { 
{-1185.9775390625,26.4111328125,14.1484375}, 
{-1724.5830078125,2559.3544921875,104.09127807617}, 
{615.744140625,850.1572265625,-43.009014129639}, 
}, 
} 
  
function zaznacz () 
for i,veh in ipairs(skasuj) do 
local x,y,z = veh[1],veh[2],veh[3] 
destroyElement(veh) 
end 
end 
addCommandHandler("zaznacz",zaznacz) 

but it's not working. What's wrong with it?

Link to comment

You'll barely find vehicles at those exact pos, if you want, i can provide a small tweak to remove vehicles from specific locations (real small ones though).

I made one:

function destroyVehicles() 
    local x, y, z = getElementPosition(localPlayer) 
    local tempCol = createColRectangle(x, y, 100, 100) 
    local vehs = getElementsWithinColShape(tempCol, "vehicle") 
    local count = 0 
    for k, v in pairs(vehs) do 
        destroyElement(v) 
        count = count+1 
    end 
    outputChatBox("Destroyed "..count.." vehicles near you.") 
    count = 0 
    destroyElement(tempCol) 
end 
addCommandHandler("dvehs", destroyVehicles) 

Link to comment
function dAllC(thePlayer) 
    accountname = getAccountName(getPlayerAccount(thePlayer)) 
    if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then 
        vehicles = getElementsByType("vehicle") 
        for i,v in ipairs(vehicles) do 
            destroyElement(getElementData(v, "parent")) 
            destroyElement(v) 
            outputChatBox("Cars have been deleted !",thePlayer, 255, 0, 0, false)            
        end 
    end 
end 
addCommandHandler("dallvehs", dAllC) 

Try this

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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