Jump to content

[HELP] About peds holding weapons


28WL

Recommended Posts

How to make that command only to groups: Owner, Admin.

How it should look like?

    ped = createPed ( 285, -2001, 122, 5001, 0, 0, 0) 
  
addCommandHandler( "weaponped", 
    function ( player, command, id, amount ) 
    if not tonumber ( id ) then 
        return 
        end 
    if not tonumber ( amount ) then 
        amount = 1 
    end 
        giveWeapon( ped, id, amount, true ) 
    end 
) 

 

function isAccountInGroup ( groups, account ) 
    local theGroup = false 
    for _, group in ipairs ( groups ) do 
        if isObjectInACLGroup ( "user.".. account, aclGetGroup ( group ) ) then 
            theGroup = group 
            break 
        end 
    end 
    return theGroup 
end 

=== How I need to do? As you see there are something wrong:

addCommandHandler( "weaponped", 
    function ( player, command, id, amount ------- cmdweaponped?) 
        if isAccountInGroup ( { "Owner", "Admin" }, getAccountName ( getPlayerAccount ( cmdweaponped ) ) ) then 
addCommandHandler( "weaponped", 
            if not tonumber ( id ) then 
                return 
                end 
            if not tonumber ( amount ) then 
                amount = 1 
             end 
                giveWeapon( ped, id, amount, true ) 
            end 
        else 
            outputChatBox ("* You have no acces to that command.", cmdweaponped ) 
        end 
    end 
) 

Link to comment

Can you please start using the correct sections?

addCommandHandler ( "weaponped", 
    function ( player, command, id, amount ) 
        if isAccountInGroup ( { "Owner", "Admin" }, getAccountName ( getPlayerAccount ( player ) ) ) then 
            if ( not tonumber ( id ) ) then 
                return 
            end 
  
            if ( not tonumber ( amount ) ) then 
                amount = 1 
            end 
  
            giveWeapon( player, id, amount, true ) 
        else 
            outputChatBox ("* You have no acces to that command.", player ) 
        end 
    end 
) 

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