Jump to content

Command


yToPzz

Recommended Posts

 

how do I make only whoever is in the ACL access this command?

 

function allvehiclesaredoomed() 
    vehicles = getElementsByType("vehicle") 
    for i,v in ipairs(vehicles) do 
        destroyElement(v) 
    end 
end 
addCommandHandler("dv", allvehiclesaredoomed) 

 

Link to comment

hello @yToPzzforum welcome to the site, you can find the answer about your topic from the link below.
IsObjectInACLGroup

 

function allvehiclesaredoomed(player) 
    local acc = getAccountName(getPlayerAccount(player)) 
    if not (isObjectInACLGroup("user."..acc, aclGetGroup("Admin"))) then 
        vehicles = getElementsByType("vehicle") 
        for i,v in ipairs(vehicles) do 
            destroyElement(v) 
        end 
    end
    return false
end 
addCommandHandler("dv", allvehiclesaredoomed) 


 

Edited by Shady1
Link to comment
function allvehiclesaredoomed() 
    local acc = getAccountName(getPlayerAccount(player)) 
    if not (isObjectInACLGroup("user."..acc, aclGetGroup("Admin"))) then return end

    vehicles = getElementsByType("vehicle") 
    for i,v in ipairs(vehicles) do 
        destroyElement(v) 
    end 
end 
addCommandHandler("dv", allvehiclesaredoomed)

I changed the old code I recommend you to try this code

  • Thanks 1
Link to comment
8 hours ago, Shady1 said:
function allvehiclesaredoomed() 
    local acc = getAccountName(getPlayerAccount(player)) 
    if not (isObjectInACLGroup("user."..acc, aclGetGroup("Admin"))) then return end

    vehicles = getElementsByType("vehicle") 
    for i,v in ipairs(vehicles) do 
        destroyElement(v) 
    end 
end 
addCommandHandler("dv", allvehiclesaredoomed)

I changed the old code I recommend you to try this code

[2022-07-19 01:09:53] WARNING: Dv\S.lua:2: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]
[2022-07-19 01:09:59] WARNING: Dv\S.lua:2: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]
[2022-07-19 01:09:59] ERROR: Dv\S.lua:3: attempt to concatenate local 'acc' (a boolean value)

 

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