Jump to content

What's The Problem??


Recommended Posts

hello i made a script that when player join and if he's admin he must be in Admins team But it's not working

here's my code

function team( player ) 
local accName = getAccountName(getPlayerAccount(player)) 
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then 
    setPlayerTeam ( player, Admins )  
end 
end 

Link to comment

Is there a code that logs the player in as soon as he joined (auto login)? If not, then it's impossible that he will be logged in immediately on join.

Perhaps you need to change onPlayerJoin to onPlayerLogin.

Link to comment

The obvious error is that Admins is not defined.

Aside from that, you're missing the admin check code.

function Team( thePlayer ) 
local accName = getAccountName(getPlayerAccount(player)) 
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then 
setPlayerTeam ( thePlayer, Admins ) 
end 
end 
addCommandHandler ( "oduty", Team ) 

Link to comment

If the team's name is "Admins" then:

function Team( thePlayer ) 
local accName = getAccountName(getPlayerAccount(player)) 
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then 
setPlayerTeam ( thePlayer, getTeamFromName("Admins")) 
end 
end 
addCommandHandler ( "oduty", Team ) 

Link to comment

You're using 'player' instead of 'thePlayer'.

function Team( thePlayer ) 
local acc = getPlayerAccount(thePlayer) 
if (isGuestAccount(acc)) then outputChatBox("You're not logged in", thePlayer) return end 
local accName = getAccountName(acc) 
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then 
 local team = getTeamFromName("Admins") 
 if (not team) then outputChatBox("The team doesn't exist", thePlayer) return end 
 setPlayerTeam ( thePlayer, team) 
else 
outputChatBox("You're not an admin", thePlayer) 
end 
end 
addCommandHandler ( "oduty", Team ) 

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