Jump to content

Destroy vehicle only IF vehicles are the specific id's


sevenlwo

Recommended Posts

Ok, i have this script, but i want him to work with specific vehicle Id's, how this line would work to say to the script that i want it works only with the specified cars?

function AdminCarRemoval ( button, state, player ) 
    if ( button == "left" and state == "down" ) then
        if ( isElement(source) ) and ( getElementType(source) == "vehicle" ) then 
            if ( isGuestAccount(getPlayerAccount(player)) ) then return end
            if ( aclGetGroup ( "Admin" ) ) and ( isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) ) then
                destroyElement (source)
                outputChatBox('Successfully destroyed the vehicle.',player,255,255,0,true)
            end
        end
    end
end

addEventHandler( "onElementClicked", getRootElement( ), AdminCarRemoval ) 

Link to comment

 

local vehicleid = getVehicleID ( theVehicle )
function AdminCarRemoval ( button, state, player ) 
    if ( button == "left" and state == "down" ) then
        if ( isElement(source) ) and ( getElementType(source) == "vehicle" ) then 
            if ( isGuestAccount(getPlayerAccount(player)) ) then return end
            if ( aclGetGroup ( "Admin" ) ) and ( isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) and (vehicleid == 411) ) then
                destroyElement (source)
                outputChatBox('Successfully destroyed the vehicle.',player,255,255,0,true)
            end
        end
    end
end

addEventHandler( "onElementClicked", getRootElement( ), AdminCarRemoval ) 

 

to add more vehicles use or ex:

(vehicleid == 411 or 412 or 413)

if this dont work try this

(vehicleid == 411 or vehicleid == 412 or vehicleid == 413)

 

Edited by Maark
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...