Jump to content

Delete vehicle from x,y,z


dewu

Recommended Posts

Posted

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?

Posted

Well, because that makes no sense, you are trying to destroy numbers...

If what you want is to remove the values from the table, then use table.remove.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 

Posted
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

sup?

Posted

Create a col-shape, get objects under the vehicles class and remove the vehicles if they're within the col-shape. Simple, I guess.

And now Aurora is back again, pm for more info.

Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA.

Ex. Developer at Community of Social Gamers - CSG

Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP

9o6E8.png Ab-47

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...