Jump to content

Easy question but im noob


Jullul7000

Recommended Posts

local staff = createTeam("Staff", 126, 0, 145) 
local staff = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    else if isObjectInACLGroup("user."..accName, aclGetGroup("Default")) then 
        setPlayerTeam(source, Regular) 
    end 
end 
  

Link to comment
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) --fixed :I 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. 
        setPlayerTeam(source, Regular) 
    end 
end 
  

ACL

Edited by Guest
Link to comment
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. 
        setPlayerTeam(source, Regular) 
    end 
end 
  

This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here:

  
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    else  -- If you want to know that if the player is in Moderator or any other group then you can use elseif. 
        setPlayerTeam(source, Regular)  
    end 
end 
  

Link to comment
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. 
        setPlayerTeam(source, Regular) 
    end 
end 
  

It's not a requirement, but doesn't mean it can't be there.

This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here:

  
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    else  -- If you want to know that if the player is in Moderator or any other group then you can use elseif. 
        setPlayerTeam(source, Regular)  
    end 
end 
  

Link to comment
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    elseif isObjectInACLGroup("user."..accName, aclGetGroup("Everyone")) then --elseif* and the Default ACL group is 'Everyone'. 
        setPlayerTeam(source, Regular) 
    end 
end 
  

It's not a requirement, but doesn't mean it can't be there.

This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here:

  
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    else  -- If you want to know that if the player is in Moderator or any other group then you can use elseif. 
        setPlayerTeam(source, Regular)  
    end 
end 
  

I understand that but it will confuse people new to lua. I mean they'll think that else and elseif are same. I'm saying this because there was time when I couldn't understand how lua works for mta and such things got me more confused. :)

Link to comment
This doesn't make sense. If the player is not in admin group then he's already in Everyone's group so "elseif" statement shouldn't be used here. Here:
  
local staff = createTeam("Staff", 126, 0, 145) 
local Regular = createTeam("Regular", 169,169,169) 
  
addEventHandler("onPlayerLogin", root, 
function(_, acc) 
    local accName = getAccountName(acc) 
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
    else  -- If you want to know that if the player is in Moderator or any other group then you can use elseif. 
        setPlayerTeam(source, Regular)  
    end 
end 
  

Uhm... yes, my error.

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