~DarkRacer~ Posted June 26, 2013 Share Posted June 26, 2013 Hey all, i'm having problem with adding an Object to an ACL group, i don't know why but when i use aclGroupAddObject it always returns FALSE maybe my code is wrong.. P.S.: i added the group the the acl and the resource has admin rights. here's the code: -- Server Side Script function addToGroup(group) group = aclGetGroup(group) if not (group == false) and not (group == nil) then account = getPlayerAccount(source) if not isGuestAccount(account) then name = getAccountName(account) add = aclGroupAddObject(group, "user"..name) if add then outputChatBox("The object has been added successfully to the group",getRootElement(),0,255,0,true) triggerClientEvent(source,"hideall",source) else outputChatBox("This object is already in the group",source,255,0,0,true) end else outputChatBox("You have to be registered before",source,255,0,0,true) end else outputChatBox("The group doesn't exist in the ACL group",source,255,0,0,true) end end addEvent("addToGroup",true) addEventHandler("addToGroup",getRootElement(), addToGroup) -- Client Side Script addEventHandler("onClientGUIClick",getRootElement(), function() if source == GUIEditor.button[1] then group = "V.I.P" triggerServerEvent("addToGroup", getLocalPlayer(), group) end end ) Link to comment
iPrestege Posted June 26, 2013 Share Posted June 26, 2013 aclGroupAddObject ( aclGetGroup( tostring ( group ) ),"user."..name) Link to comment
~DarkRacer~ Posted June 26, 2013 Author Share Posted June 26, 2013 aclGroupAddObject ( aclGetGroup( tostring ( group ) ),"user."..name) It didn't work.. Debugscript 3 no errors Link to comment
PaiN^ Posted June 26, 2013 Share Posted June 26, 2013 Try this one : -- Server Side Script function addToGroup( group ) group = aclGetGroup( group ) if group == false or group == nil then error( "The value of the 'group' is nil or false !" ) end account = getPlayerAccount( source ) if not isGuestAccount( account ) then local name = getAccountName( account ) local add = aclGroupAddObject( group, "user."..name ) if add then outputChatBox( "The object has been added successfully to the group", root, 0, 255, 0, true ) triggerClientEvent( source, "hideall", source ) else outputChatBox( "This object is already in the group", source, 255, 0, 0, true ) end else outputChatBox( "You have to be registered before", source, 255, 0, 0, true ) end else outputChatBox( "The group doesn't exist in the ACL group", source, 255, 0, 0, true ) end addEvent( "addToGroup", true ) addEventHandler( "addToGroup", root, addToGroup ) Link to comment
~DarkRacer~ Posted June 27, 2013 Author Share Posted June 27, 2013 Try this one : -- Server Side Script function addToGroup( group ) group = aclGetGroup( group ) if group == false or group == nil then error( "The value of the 'group' is nil or false !" ) end account = getPlayerAccount( source ) if not isGuestAccount( account ) then local name = getAccountName( account ) local add = aclGroupAddObject( group, "user."..name ) if add then outputChatBox( "The object has been added successfully to the group", root, 0, 255, 0, true ) triggerClientEvent( source, "hideall", source ) else outputChatBox( "This object is already in the group", source, 255, 0, 0, true ) end else outputChatBox( "You have to be registered before", source, 255, 0, 0, true ) end else outputChatBox( "The group doesn't exist in the ACL group", source, 255, 0, 0, true ) end addEvent( "addToGroup", true ) addEventHandler( "addToGroup", root, addToGroup ) Thanks it's working but i don't understand what did you do? 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