Jump to content

[HELP] Problem with isObjectInACLGroup


steadyfi

Recommended Posts

Hello, i've got a little problem with my script.

I use this script to create a team when it starts and set the Admins to that group when they login.

But i get an error every time, it says that it cannot find global variable getAccountName and getPlayerAccount

Script: Server-Side

--Create teams on resource start 
function createTeams(source, teamName) 
    staff = createTeam("GameCentral //Admins", 102, 0, 0) 
end 
addEventHandler("onResourceStart", getRootElement(), createTeams) 
  
--Set Admin team 
function setAdminTeam(source) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then 
        setPlayerTeam(source, staff) 
        local r,g,b = getPlayerNametagColor(source) 
        local name = getPlayerName(source) 
        outputChatBox("#00FF00Greetings: "..name, getRootElement(), r, g, b, true) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), setAdminTeam) 

Error:

[2014-11-19 21:10:43] WARNING: [race]\[mods]\gc_basic\modules\teams.lua:9: Bad argument @ 'getPlayerAccount' [Expected element at argument 1] 
[2014-11-19 21:10:43] WARNING: [race]\[mods]\gc_basic\modules\teams.lua:9: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] 
[2014-11-19 21:10:43] ERROR: [race]\[mods]\gc_basic\modules\teams.lua:9: attempt to concatenate a boolean value 

Thanks

Link to comment

Put the script server-side and try this:-

--Create teams on resource start 
function createTeams() 
    staff = createTeam("GameCentral //Admins", 102, 0, 0) 
end 
addEventHandler("onResourceStart", getRootElement(), createTeams) 
  
--Set Admin team 
function setAdminTeam(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 
        setPlayerTeam(thePlayer, staff) 
        local r,g,b = getPlayerNametagColor(thePlayer) 
        local name = getPlayerName(thePlayer) 
        outputChatBox("#00FF00Greetings: "..name, getRootElement(), r, g, b, true) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), setAdminTeam) 
  

Link to comment
Just remove source from line 8.
function setAdminTeam() 

Thanks it worked :D

Put the script server-side and try this:-
--Create teams on resource start 
function createTeams() 
    staff = createTeam("GameCentral //Admins", 102, 0, 0) 
end 
addEventHandler("onResourceStart", getRootElement(), createTeams) 
  
--Set Admin team 
function setAdminTeam(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 
        setPlayerTeam(thePlayer, staff) 
        local r,g,b = getPlayerNametagColor(thePlayer) 
        local name = getPlayerName(thePlayer) 
        outputChatBox("#00FF00Greetings: "..name, getRootElement(), r, g, b, true) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), setAdminTeam) 
  

Think it worked too , didn't try, but thanks anyway for helping me !

#SOLVED

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