Jump to content

Duty command


DarkByte

Recommended Posts

I made a command that sets a player to be on duty but it wont work.

  
function duty (playerSource) 
if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( playerSource ) ), aclGetGroup ( "Admin" ) ) 
setElementData(playerSource,"duty",true) 
outputChatBox("It works") 
else 
setElementData(playerSource,"duty",false) 
end 
end 
  
addCommandHandler("duty",duty) 

Link to comment
function duty (playerSource) 
    local acc = getPlayerAccount ( playerSource ) 
    if (acc and not isGuestAccount(acc)) then 
        if isObjectInACLGroup ( "user.".. getAccountName ( acc ), aclGetGroup ( "Admin" ) ) 
            setElementData(playerSource,"duty",true) 
            outputChatBox("It works", playerSource) 
        else 
            setElementData(playerSource,"duty",false) 
            outputChatBox("You're not an Admin!", playerSource) 
        end 
    else 
        outputChatBox("You're not logged it!", playerSource) 
    end 
end 
addCommandHandler("duty",duty) 

Try this.

Link to comment
function duty (playerSource) 
    local acc = getPlayerAccount ( playerSource ) 
    if (acc and not isGuestAccount(acc)) then 
        if isObjectInACLGroup ( "user.".. getAccountName ( acc ), aclGetGroup ( "Admin" ) ) 
            setElementData(playerSource,"duty",true) 
            outputChatBox("It works", playerSource) 
        else 
            setElementData(playerSource,"duty",false) 
            outputChatBox("You're not an Admin!", playerSource) 
        end 
    else 
        outputChatBox("You're not logged it!", playerSource) 
    end 
end 
addCommandHandler("duty",duty) 

Try this.

You forgot "then".

if isObjectInACLGroup ("user.".. getAccountName (acc), aclGetGroup ("Admin")) then 

Link to comment
function duty (playerSource) 
    local acc = getPlayerAccount ( playerSource ) 
    if (acc and not isGuestAccount(acc)) then 
        if isObjectInACLGroup ( "user.".. getAccountName ( acc ), aclGetGroup ( "Admin" ) ) then 
            setElementData(playerSource,"duty",not getElementData(playerSource,"duty")) 
        else 
            outputChatBox("You're not an Admin!", playerSource) 
        end 
    else 
        outputChatBox("You're not logged it!", playerSource) 
    end 
end 
addCommandHandler("duty",duty) 

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