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 

sup?

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 ) 

sup?

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 ) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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 ) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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

sup?

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 ) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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