Jump to content

help with isObjectInACLGroup


Kenix

Recommended Posts

player login and the chat message is displayed that he entered as ...

error 4 line bad argument @ "getAccountName"

  
function onLogineng ( players, users, passs ) 
    local accounts = getAccount ( users, passs ) 
     local accountname = getAccountName (getPlayerAccount(source)) 
    if ( accounts ~= false ) then 
        if (logIn ( players, accounts, passs ) == true) then 
          triggerClientEvent ( "OnPlayerLoginFromServereng", getRootElement()) 
            if isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Moderator" ) ) then 
            outputChatBox("[sERV] Player"..getPlayerName(source).." join Moderator") 
            elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "SuperModerator" ) ) then 
            outputChatBox("[sERV] Player"..getPlayerName(source).." join SuperModerator") 
            elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Admin" ) ) then 
           outputChatBox("[sERV] Player"..getPlayerName(source).." join Admin") 
          end    
        else 
            outputChatBox ( "[sERV] error login", players, 255, 255, 0 )  
        end 
  
    else 
        outputChatBox ( "[sERV] error nickname or password!", players, 255, 255, 0 )  
    end 
end 
  
addEvent( "onSendLogineng", true ) 
addEventHandler( "onSendLogineng", getRootElement(), onLogineng ) 
  

Link to comment
i think
local accountname = users  

but you should show us what trigger "onSendLogineng", as we can only guess what source,players, users and passs are...

  
function playerlogin()  
    local login = guiGetText(GUIEditor_Edit[8])  
    local password = guiGetText(GUIEditor_Edit[9])  
    if(login == "" and login ~= nil or password == "" and password ~= nil) then  
        outputChatBox("[sERV] Please fill in all fields",255,255,0,true )  
    else  
        triggerServerEvent ( "onSendLogineng", getRootElement(), getLocalPlayer(), guiGetText(GUIEditor_Edit[8]), guiGetText(GUIEditor_Edit[9]) ) 
    end          
end 
  

Link to comment

I going to do something for you, and let you fix this code yourself

triggerServerEvent ( "onSendLogineng", getRootElement(), getLocalPlayer(), guiGetText(GUIEditor_Edit[8]), guiGetText(GUIEditor_Edit[9]) ) 

you see, you put a root element sa a second parameter, that menns the source of this event will be the root element, not a player.

https://wiki.multitheftauto.com/wiki/Element_tree

getLocalPlayer() returns a player on whos computer the script is running, so argument "players" in function "onLogineng" will contain a player

getPlayerAccount() cann not be run for root element, but it can be run for a player

hope you will understand and fix ALL the errors (there is more than one in youre script...)

Link to comment
I going to do something for you, and let you fix this code yourself
triggerServerEvent ( "onSendLogineng", getRootElement(), getLocalPlayer(), guiGetText(GUIEditor_Edit[8]), guiGetText(GUIEditor_Edit[9]) ) 

you see, you put a root element sa a second parameter, that menns the source of this event will be the root element, not a player.

https://wiki.multitheftauto.com/wiki/Element_tree

getLocalPlayer() returns a player on whos computer the script is running, so argument "players" in function "onLogineng" will contain a player

getPlayerAccount() cann not be run for root element, but it can be run for a player

hope you will understand and fix ALL the errors (there is more than one in youre script...)

you mean that's?

  
triggerServerEvent ( "onSendLogineng", getLocalPlayer(),getLocalPlayer(), guiGetText(GUIEditor_Edit[8]), guiGetText(GUIEditor_Edit[9]) ) 
  

Link to comment
  • Moderators

Yeah he means that but why you want to pass the 2nd getLocalPlayer() ?

I know it's for store the playerElement in players:

function onLogineng ( players, users, passs )

But you can make like this:

triggerServerEvent ( "onSendLogineng", getLocalPlayer(),  guiGetText(GUIEditor_Edit[8]), guiGetText(GUIEditor_Edit[9]) ) 

So you can delete players:

function onLogineng ( users, passs ) 

So use source instead of players

And I have another one: Why you made a guiGetText 2 times ?

You made this:

local login = guiGetText(GUIEditor_Edit[8]) 
local password = guiGetText(GUIEditor_Edit[9]) 

So you can use login and password in your triggerServerEvent like this:

triggerServerEvent ( "onSendLogineng", getLocalPlayer(),  login, password ) 

Link to comment
  • Moderators

So you didn't get any error ?

try this code( with this code, if you aren't in the ACL, it says: "You are not in the ACL" ):

function onLogineng ( players, users, passs ) 
    local accounts = getAccount ( users, passs ) 
     local accountname = getAccountName (getPlayerAccount(source)) 
    if ( accounts ~= false ) then 
        if (logIn ( players, accounts, passs ) == true) then 
            triggerClientEvent ( "OnPlayerLoginFromServereng", getRootElement()) 
            if isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Moderator" ) ) then 
                outputChatBox("[sERV] Player"..getPlayerName(source).." join Moderator") 
            elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "SuperModerator" ) ) then 
                outputChatBox("[sERV] Player"..getPlayerName(source).." join SuperModerator") 
            elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Admin" ) ) then 
                outputChatBox("[sERV] Player"..getPlayerName(source).." join Admin") 
            ------------------------------------- TEST --------------------------------- 
            else 
                outputChatBox("You are not in the ACL", thePlayer ) 
            ------------------------------------------------------------------------------- 
            end    
        else 
            outputChatBox ( "[sERV] error login", players, 255, 255, 0 ) 
        end 
  
    else 
        outputChatBox ( "[sERV] error nickname or password!", players, 255, 255, 0 ) 
    end 
end 

Link to comment
So:

1 - You are not in the ACL group

or

2 - There is a problem with accountname

And maybe try this:

local accounts = getAccount ( users, passs ) 
local accountname = getAccountName (accounts) 

It Works !

thanks a lot dude :)

Link to comment

the problem with accountname is most likely the reason, but if volk-rus wont understand why there is a problem wit this variable he will still ask people to debug his scripts for him...

He is making his own gamemode, and should be experience scripter by now, but he slill have a problem with basic stuff...

getPlayerAccount(source) 

used before

logIn ( players, accounts, passs ) 

will most likely return a guest account, and i dont even know if you can get a name fo that...

i also think that

local accounts = getAccount ( users, passs ) 
local accountname = getAccountName (accounts) 

is the same as

local accountname = users 

if "users" is a valid account name

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