Jump to content

I need help again with Setting Teams.. :/


Xeno

Recommended Posts

1. How would I make it so if an Admin logged on, his team would be changed to admin? Heres what I got so far...

function onAdminJoin() 
if isObjectInACLGroup("user." .. playerName, aclGetGroup ("Admin" ) )  then 
local team =getTeamFromName("Admins") 
setPlayerTeam (source, team) 
end 
addEventHandler("onPlayerLogin", getRootElement(), onAdminJoin) 

This doesnt seem to work... Please help :/

Link to comment

playerName isn't defined, you can use this

function onAdminJoin(_,account) 
     local account = getAccountName ( account ) 
     if ( isObjectInACLGroup ( "user." .. account, aclGetGroup ( "Admin" ) ) ) then 
     local team = getTeamFromName ( "Admins" ) 
     setPlayerTeam( source, team ) 
     end 
end 
addEventHandler("onPlayerLogin", getRootElement(), onAdminJoin) 
  

Link to comment

Made The Indipenden Function and call with setTimer

example :

function onAdminJoin(player) 

function setAdminTeam() 
setTimer(onAdminJoin,500,1,source) 
end 
addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) 

For More info Look this my script :

function setAdminColor(player) 
    local theAccount=getPlayerAccount(player) 
    if theAccount then 
    local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    local adminInVehicle = getPedOccupiedVehicle ( player ) 
        setVehicleColor ( adminInVehicle, 3, 0, 0, 0 ) -- Change Color Here 
        end 
end 
end 
  
function spawnAdmin() 
setTimer(setAdminColor,500,1,source) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),spawnAdmin) 

Change the onPlayerSpawn with onPlayerLogin

Link to comment
Made The Indipenden Function and call with setTimer

example :

function onAdminJoin(player) 

function setAdminTeam() 
setTimer(onAdminJoin,500,1,source) 
end 
addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) 

For More info Look this my script :

function setAdminColor(player) 
    local theAccount=getPlayerAccount(player) 
    if theAccount then 
    local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    local adminInVehicle = getPedOccupiedVehicle ( player ) 
        setVehicleColor ( adminInVehicle, 3, 0, 0, 0 ) -- Change Color Here 
        end 
end 
end 
  
function spawnAdmin() 
setTimer(setAdminColor,500,1,source) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),spawnAdmin) 

Change the onPlayerSpawn with onPlayerLogin

I get two erros when I login: Bad argument @ getPlayerAccount [Expected Elemtn at argument , got nil]

attenmpt to concatenate global "accountName" (a nil value)

Link to comment

This :

function setAdminTeam(player) 
    local theAccount=getPlayerAccount(player) 
    if theAccount then 
    local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    local team = getTeamFromName ( "Admins" ) 
     setPlayerTeam( player, team ) 
        end 
end 
end 
  
function teamAdmin() 
setTimer(setAdminTeam,500,1,source) 
end 
addEventHandler("onPlayerLogin",getRootElement(),teamAdmin) 

ServerSide and add the resource in ACL group admin

Link to comment
This :
function setAdminTeam(player) 
    local theAccount=getPlayerAccount(player) 
    if theAccount then 
    local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    local team = getTeamFromName ( "Admins" ) 
     setPlayerTeam( player, team ) 
        end 
end 
end 
  
function teamAdmin() 
setTimer(setAdminTeam,500,1,source) 
end 
addEventHandler("onPlayerLogin",getRootElement(),teamAdmin) 

ServerSide and add the resource in ACL group admin

That has worked perfectly, thanks a bunch :3

And thanks for all the other people who put in information to<3

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