Jump to content

[HELP] About sounds player


28WL

Recommended Posts

Posted

How I can make this script only for groups: Owners, Admins ---> and it should hear everyone when one of this group members will write a command /PS1?

addCommandHandler ( "PS1", 
    function ( Play_Sound_1 ) 
        if isAccountInGroup ( { "Owner", "Admin", "28WLSF" }, getAccountName ( getPlayerAccount ( Play_Sound_1 ) ) ) then 
        setTimer(function() 
            playSound("Sounds/Sound_1.mp3") 
        end, 1000, 1) 
        else 
            outputChatBox ("* You have no acces to that command.", Play_Sound_1 ) 
        end 
    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 

I tried to make it, but I can't hear it.

Write, how it should look like, where is the problems?

Thanks.

You can hire me!

Posted

playSound is a client side only function, and your script is server side.

You must use triggerClientEvent and add the event client side to play the sound there.

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.

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