Jump to content

ACL groups


Tekken

Recommended Posts

Hello guys,

I have a custom Ban system and it work's like that

/aban Name Reason, and it take player serial and put it on a ACL group named Baned like this user.PLAYERSERIAL and when player join check if that player serial is in that ACL group and if is it kick that player.

My ask is if i can make it like that user.PlayerSerial.(PlayerName).(Reason) , it work but how to check when player join ?

My script :

function checkBlockedSerial() 
    if isObjectInACLGroup("user."..getPlayerSerial(source), aclGetGroup("Banned")) then 
        kickPlayer(source, "You are banned!") 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), checkBlockedSerial) 

Link to comment

You won't be able to use isObjectInACLGroup as you don't know the player name and the reason, therefore you must use aclGroupListObjects to get a list of all objects and do a loop and use gettok.

Example:

StR = "user.TheSerial.PlayerName.Reason" 
  
Serial = gettok(StR, 2, string.byte(".")) 
Name = gettok(StR, 3, string.byte(".")) 
Reason = gettok(StR, 4, string.byte(".")) 
  
outputChatBox(Serial) 
outputChatBox(Name) 
outputChatBox(Reason) 

PS: I'm not sure if you could use more than one dot in the object you might need to use other symbol.

Link to comment

Will this work ?

function checkBlockedSerial() 
    object = aclGroupListObjects(aclGetGroup("Banat")) 
    if object then 
        PSerial = getPlayerSerial(source) 
        Serial = gettok(object, 2, string.byte(".")) 
        Name = gettok(object, 3, string.byte(".")) 
        Reason = gettok(object, 4, string.byte("."))      
        if Serial == PSerial then 
            kickPlayer(source, tostring(Reason)) 
        end   
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), checkBlockedSerial) 

Link to comment

then this ?

function checkBlockedSerial() 
    object = aclGroupListObjects(aclGetGroup("Banat")) 
    for i, v in ipairs(object) do 
        PSerial = getPlayerSerial(source) 
        Serial = gettok(v, 2, string.byte(".")) 
        Name = gettok(v, 3, string.byte(".")) 
        Reason = gettok(v, 4, string.byte("."))     
        if Serial == PSerial then 
            kickPlayer(source, tostring(Reason)) 
        end   
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), checkBlockedSerial) 

Link to comment

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