Jump to content

Add/Remove ACL user


WiBox

Recommended Posts

Posted

I made a panel for add a thing to a group in ACL..

I want by a click of a button the player get added to that group and buy a click he get removed.. any ideas?

My problem is to check if the player is already in that ACL group, what I want to do:

button named: Buy Donator

if he already got Donator then the button will be disabled with guiSetProperty but the thing is I need to know if the players isObjectInACLGroup but didn't work for me.. Any help please

 

Posted

Users are stored in ACL with the prefix user. and their usernames with what they registered and logged in on the server. So like a player registers on the server with username Doe, he will be stored in the ACL like user.Doe . You have to use this format in the isObjectInACLGroup to check it properly.

Posted (edited)

I used:

function isPlayerDonator(plr)
    accName = getAccountName(getPlayerAccount(plr))
    if ( isObjectInACLGroup("user."..accName, aclGetGroup("Donator")) then
        return true
    else
        return false
    end
end
addEvent("isPlayerDonator", true)
addEventHandler("isPlayerDonator", root, isPlayerDonator)

but I didn't know how to write in client side, if isPlayerDonator == true then if == false then... Any tips?

Edited by SSKE
  • Discord Moderators
Posted (edited)

you can't use simple "return" to return a value from a server-sided function to a client-side one, but instead you need to triggerClientEvent with a value.
Actually, you don't even need those 'if' statements.

addEvent("isPlayerDonator", true)
addEventHandler("isPlayerDonator", root, function()
  triggerClientEvent("isPlayerDonatorAnswer", client, isObjectInACLGroup("user."..tostring(getAccountName(getPlayerAccount(plr))), aclGetGroup("Donator"))
end)

 

Edited by Pirulax
  • Discord Moderators
Posted (edited)

Jesus Christ help me.
This is the way you can do it.

Anyways, why do you need to check C.-S. if a player is a donator or not?

Edited by Pirulax
Posted (edited)

Because I'm making as with a click of a button the player get added to donator ACL Group, and if the player is already in the donate acl group i want to disable the button 

I made a panel with a button which I want from it with a click of a button it add a player in the donator acl group, but I want if the player already in that acl group the button will be disable so he don't repress it, that's why I need to check if the player already in the Donator acl group or not and use it in Client Side so I can use guiSetProperty

 

Edited by SSKE

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