28WL Posted January 12, 2014 Share Posted January 12, 2014 //CLIENT SIDE addCommandHandler ( "ps1", function ( plays_1 ) if isAccountInGroup ( { "Owner", "Admin" }, getAccountName ( getPlayerAccount ( plays_1 ) ) ) then setTimer(function() playSound("sounds/sound_1.mp3") end, 1000, 1) else outputChatBox ("[info]: You have no acces to that command.", plays_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 //SERVER SIDE triggerClientEvent??? How it should be? Well, what I need to write in server side? I want to make that only members of that group could play this sound to everyone. Please, if you can write a script here. Link to comment
Castillo Posted January 12, 2014 Share Posted January 12, 2014 -- server side: addCommandHandler ( "ps1", function ( plays_1 ) if isAccountInGroup ( { "Owner", "Admin" }, getAccountName ( getPlayerAccount ( plays_1 ) ) ) then setTimer ( triggerClientEvent, 1000, 1, "playASound", root, "sounds/sound_1.mp3" ) else outputChatBox ("[info]: You have no acces to that command.", plays_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 -- client side: addEvent ( "playASound", true ) addEventHandler ( "playASound", root, function ( path ) playSound ( path ) end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now