MRThinker Posted July 9, 2018 Share Posted July 9, 2018 hi all please give a server side for set Player ACL Group like : syntax : /setacl <playerName> <AclName> and outputChatBox for Player is : Your ACL Group has been changed to <AclName> thanks! Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 @Galactix you can give me this script ? Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) function findPlayer( namepart ) local player = getPlayerFromName( namepart ) if player then return player end for _,player in pairs( getElementsByType 'player' ) do if string.find( string.gsub( getPlayerName( player ):lower( ),"#%x%x%x%x%x%x", "" ), namepart:lower( ), 1, true ) then return player end end return false end addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(player) aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..playerAccount) end end) Edited July 9, 2018 by Galactix Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 @Galactix this script is dont have outputChatBox! Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(player) aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..playerAccount) outputChatBox("The account "..playerAccount.." has been successfully added to the "..aclgroup.." group!", player) end end) Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 @Galactix no! please add the outputChatBox : Only Admins Can Use This CMD please add the outputChatBox : Your ACL Group Changed To "..aclgroup.." Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(find) local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..accName) outputChatBox("Your ACL group has been changed to "..aclgroup.."!", player) else outputChatBox("You are not allowed to use this command!", player, 255,0,0) end end end) Edited July 9, 2018 by Galactix Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 function findPlayer( namepart ) local player = getPlayerFromName( namepart ) if player then return player end for _,player in pairs( getElementsByType 'player' ) do if string.find( string.gsub( getPlayerName( player ):lower( ),"#%x%x%x%x%x%x", "" ), namepart:lower( ), 1, true ) then return player end end return false end addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(find) local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..accName) outputChatBox("Your ACL group has been changed to "..aclgroup.."!", player) else outputChatBox("You are not allowed to use this command!", player, 255,0,0) end end end) this script is not working Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(find) local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..accName) outputChatBox("Your ACL group has been changed to "..aclgroup.."!", source) else outputChatBox("You are not allowed to use this command!", source, 255,0,0) end end end) Also, make sure that the resource you are using has admin rights. Edited July 9, 2018 by Galactix Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 no this script dont have errors not working! you can give me a faction system? your script is dont have a function ! why ? Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 The function is directly in the commandHandler. I just tested the command on my server and it works perfectly, but the resource has to have admin rights. Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 You also need to keep the findPlayer function in the script for it to work. Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 ok wait! the error : [2018-07-09 22:39:33] SetAcl restarted successfully [2018-07-09 22:39:36] WARNING: SetAcl\server.lua:2: Bad argument @ 'getPlayerFromName' [Expected string at argument 1, got nil] [2018-07-09 22:39:36] ERROR: SetAcl\server.lua:7: attempt to index local 'namepart' (a nil value) when use this script : [2018-07-09 22:40:09] WARNING: SetAcl\server.lua:23: Bad argument @ 'outputChatBox' [Expected element at argument 2, got string 'MR_ThinkeR'] this is my server side: function findPlayer( namepart ) local player = getPlayerFromName( namepart ) if player then return player end for _,player in pairs( getElementsByType 'player' ) do if string.find( string.gsub( getPlayerName( player ):lower( ),"#%x%x%x%x%x%x", "" ), namepart:lower( ), 1, true ) then return player end end return false end addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(find) local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..accName) outputChatBox("Your ACL group has been changed to "..aclgroup.."!", player) else outputChatBox("You are not allowed to use this command!", player, 255,0,0) end end end) Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 function findPlayer( namepart ) local player = getPlayerFromName( namepart ) if player then return player end for _,player in pairs( getElementsByType 'player' ) do if string.find( string.gsub( getPlayerName( player ):lower( ),"#%x%x%x%x%x%x", "" ), namepart:lower( ), 1, true ) then return player end end return false end addCommandHandler('setacl',function(source,_,player,aclgroup) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(find) local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then aclGroupAddObject (aclGetGroup(""..aclgroup..""), "user."..accName) outputChatBox("Your ACL group has been changed to "..aclgroup.."!", find) else outputChatBox("You are not allowed to use this command!", source, 255,0,0) end else outputChatBox("Player not found!", source, 255,0,0) end end) Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 now errors are : [2018-07-09 22:51:24] WARNING: SetAcl\server.lua:2: Bad argument @ 'getPlayerFromName' [Expected string at argument 1, got nil] [2018-07-09 22:51:24] ERROR: SetAcl\server.lua:7: attempt to index local 'namepart' (a nil value) Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 @Galactix you can give me a script for set skin player and outputChatBox "Your Skin Changed By Admin <adminName> ! Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) addCommandHandler('setskin',function(source,_,player,skinid) local find = findPlayer( player ) if find then local playerAccount = getPlayerAccount(source) local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementModel ( find, skinid ) outputChatBox("Your skin was changed to "..skinid.." by the admin "..accName.."!", find) else outputChatBox("You are not allowed to use this command!", source, 255,0,0) end else outputChatBox("Player not found!", source, 255,0,0) end end) And you get the error because the player you want to change the ACL is not online. Don't forget to add a little "Thanks" for the help Edited July 9, 2018 by Galactix 1 Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 6 minutes ago, MRThinker said: thanks I meant reaction but that’s ok ^^ 1 Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 @Galactix hey you! im stopped the [admin] resouce and use the /setskin ! not working how to fix it? Link to comment
MRThinker Posted July 9, 2018 Author Share Posted July 9, 2018 i dont error! server not give me skin! Link to comment
Galactix Posted July 9, 2018 Share Posted July 9, 2018 (edited) The script works perfectly for me. You have to do /setskin (name) (skin id) Edited July 9, 2018 by Galactix 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