Jump to content

What's The Problem??


Recommended Posts

Posted

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 

Posted

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.

Posted

okay i made another one i maked it with command but it's not working o.O

function Team( thePlayer ) 
setPlayerTeam ( thePlayer, Admins )  
end 
addCommandHandler ( "oduty", Team ) 

Posted

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 ) 

Posted

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 ) 

Posted

i've created team called Admins And when i set my self Admin it works ofc it works :3

but when i reconnect i find my self not in the admins team

i typed /oduty still nothing

Posted

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 ) 

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