Jump to content

Basic admin system


Recommended Posts

Hello all i want to create a new admin system with acl, but i stock :(

I want to make like if the OffDutyAdmin type in duty then he get admin and he type in duty again the he turn to the offdutyAdmin acl which is same level like a normal player, but he can use the command to turn back to the admin duty and the normal players cant

I read some wiki and i make like this but something is wrong :(

  
function assignNewTeam ( source, commandName, teamName ) 
    local theTeam = createTeam ( Admin ) 
        if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(playersource)), aclGetGroup("OffDutyAdmin")) then 
        setPlayerTeam (source, theTeam)  
end 
addCommandHandler ( "duty", assignNewTeam ) 

Link to comment

--Server side only !

addCommandHandler ( "duty",  
function (thePlayer) 
    local theTeam = createTeam ("Admin",255,255,255) 
    local accountname = getAccountName ( getPlayerAccount ( thePlayer )) 
    if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then 
    setPlayerTeam (thePlayer,theTeam) 
    end 
end) 
  

Edited by Guest
Link to comment
  
 local offdutyTeam = createTeam ("OffDuty",100,100,100) 
 local theTeam = createTeam ("Admin",255,255,255) 
addCommandHandler ( "duty", 
function (thePlayer) 
    local accountname = getAccountName ( getPlayerAccount ( thePlayer )) 
    if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then 
    setPlayerTeam (thePlayer,theTeam) 
    end 
end) 
  
addCommandHandler ("offduty", 
function (thePlayer) 
 setPlayerTeam (thePlayer,offdutyTeam ) 
end) 

Edited by Guest
Link to comment

something like this

  
addCommandHandler ( "duty", 
function (thePlayer) 
   if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then 
    --- he was set in to the admin acl group but i dont no the lua word  
 else  
     if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "Admin" )) then 
   ---* he was get back the OffDutyAdmin group and removed from the admin group 
    end 
end) 
  
  

Link to comment

You mean that?

--Server side:

You have to add your account name in ACL group "OffDutyAdmin" and "Admin"

local offdutyTeam = createTeam ("OffDuty",100,100,100) 
local theTeam = createTeam ("Admin",255,255,255) 
addCommandHandler ( "duty", 
function (thePlayer) 
   local accountname = getAccountName ( getPlayerAccount ( thePlayer )) 
   if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then 
   setPlayerTeam (thePlayer,offdutyTeam) 
 else 
     if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "Admin" )) then 
       setPlayerTeam (thePlayer,theTeam) 
       end 
    end 
end) 

Link to comment

no because if i have a permision to the admin acl then i can use the pane, but if have a permision to the offduty then i dont have a permision to use the panel

But is u have a better idea to make a script for the admins like they can play out the duty and they can use the commannds only if they are on duty then dont have unfair in game :D maybe now u get me xD because my english is not the best

Link to comment

Use setAccountData instead of assigning ACL for duty state.

setAccountData(getPlayerAccount(thePlayer), "duty", true) -- Onduty 
setAccountData(getPlayerAccount(thePlayer), "duty", true) -- Offduty 

Would look like this:

addCommandHandler("duty", 
    function(thePlayer) 
        local account = getPlayerAccount(thePlayer) 
        if not isObjectInACLGroup("user."..getAccountName(account), aclGetGroup"Admin") then return end 
        if getAccountData(account, "duty") ~= true then 
            setAccountData(account, "duty", true) -- Now he's onduty 
        else 
            setAccountData(account, "duty", false) -- Offduty. 
        end 
    end 
) 

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