Jump to content

[HELP] Deleting all vehicles


..:D&G:..

Recommended Posts

Hello guys, I am trying to make a small function to delete all the vehicles from the server, but it doesn't seem to work and there are no errors:

function delAllVehs(player) 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
        for key, value in pairs( getElementsByType( "vehicle" ) ) do 
            if isElement( value ) then 
                destroyElement( value ) 
                outputChatBox(#value.." vehicles deleted!", player) 
            end 
        end 
    end 
end 
addCommandHandler("delvehs", delAllVehs) 

Thank you.

Link to comment
function delAllVehs(player) 
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
        for key, value in pairs( getElementsByType( "vehicle" ) ) do 
            if isElement( value ) then 
                destroyElement( value ) 
                count = key 
            end 
        end 
    if count ~= nil then  
            outputChatBox(count.." vehicles deleted!", player) 
        end 
    end 
end 
addCommandHandler("delvehs", delAllVehs) 

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