Jump to content

Basic admin system


Recommended Posts

Posted

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 ) 

Posted (edited)

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

I want like if a player in OffDuty acl type in duty then he get a Admin acl and removed from the OffDuty acl group and if a player in Admin acl type in offduty then he get in to the offduty acl group and removed from the admin acl group

Posted

I already fixed the code, what you need exactly? Because i didn't get your point

EDIT: you want if the player typed /offduty he get in another team?

Posted

yes something like that

If a player with admin acl type in offduty then he remove the admin acl team and he get a offduty acl group,

and if the player was type in duty then he get admin acl and he was removed from the offduty acl

Posted (edited)
  
 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
Posted

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) 
  
  

Posted

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) 

Posted

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

Posted
i think you no the roleplay servers :D i want that type a admin system :D

It no matter if i know RP or RPG xD just explain your problem more clear to let people understand it, if you can't explain then post some screenshots / videos..

Posted

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 
) 

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