Jump to content

Help!


DRW

Recommended Posts

teamplayers = createTeam (Jugadores, 255,255,255) 
  
function jugadores (thePlayer) 
if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Anarquia")) then 
if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Alianza")) then 
setPlayerTeam (thePlayer, Jugadores) 
end 
end) 
  
  
addEventHandler ( "onResourceStart", getRootElement(), jugadores ) 

What did I do wrong?

My idea was to make a team for players that are not in Alianza nor Anarquia ACL groups, but it's not working.

Link to comment
teamplayer = createTeam(jugadores, 255, 255, 255) 
  
function jugadores(thePlayer) 
     local account = getPlayerAccount(thePlayer) 
     local accountName = getAccountName(account) 
     if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then 
        setPlayerTeam(thePlayer, teamplayer) 
    end 
end 
addEventHandler("onResourceStart", root, jugadores) 

Link to comment
teamplayer = createTeam(jugadores, 255, 255, 255) 
  
function jugadores(thePlayer) 
     local account = getPlayerAccount(thePlayer) 
     local accountName = getAccountName(account) 
     if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then 
        setPlayerTeam(thePlayer, teamplayer) 
    end 
end 
addEventHandler("onResourceStart", root, jugadores) 

Still not working

Link to comment
teamplayer = createTeam(jugadores, 255, 255, 255) 
  
function jugadores(thePlayer) 
     if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Anarquia")) or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Alinaza")) then 
        setPlayerTeam(source, teamplayer) 
    end 
end 
addEventHandler("onResourceStart", root, jugadores) 

Link to comment

Still not working, for now, I have made this

teamplayer = createTeam("Jugadores", 255, 255, 255) 
  
function jugadores(thePlayer) 
     if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Anarquia")) or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Alianza")) then 
        setPlayerTeam(source, teamplayer) 
    end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), jugadores) 

Link to comment
teamplayer = createTeam(jugadores, 255, 255, 255) 
  
function jugadores(thePlayer) 
     if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Anarquia")) or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Alianza")) then 
         setPlayerTeam(thePlayer, teamplayer) 
    end 
end 
addEventHandler("onPlayerJoin", root, jugadores) 

Link to comment

-- Client side

addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    triggerServerEvent( "clientReady", resourceRoot ) 
end 
) 

teamplayer = createTeam("Jugadores", 255, 255, 255) 
  
  
addEvent("clientReady", true ) 
addEventHandler("clientReady",resourceRoot, 
function() 
     local account = getPlayerAccount(client) 
     local accountName = getAccountName(account) 
     if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then 
        setPlayerTeam(client, teamplayer) 
    end 
end 
) 

Link to comment
-- Client side
addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    triggerServerEvent( "clientReady", resourceRoot ) 
end 
) 

teamplayer = createTeam("Jugadores", 255, 255, 255) 
  
  
addEvent("clientReady", true ) 
addEventHandler("clientReady",resourceRoot, 
function() 
     local account = getPlayerAccount(client) 
     local accountName = getAccountName(account) 
     if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then 
        setPlayerTeam(client, teamplayer) 
    end 
end 
) 

Still not working

Link to comment
-- Client side
addEventHandler("onClientResourceStart",resourceRoot, 
function() 
    triggerServerEvent( "clientReady", resourceRoot ) 
end 
) 

teamplayer = createTeam("Jugadores", 255, 255, 255) 
  
  
addEvent("clientReady", true ) 
addEventHandler("clientReady",resourceRoot, 
function() 
     local account = getPlayerAccount(client) 
     local accountName = getAccountName(account) 
     if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then 
        setPlayerTeam(client, teamplayer) 
    end 
end 
) 

Still not working

Not work because you'll never did ACL groups named Anarquia and Alianza, should be created in ACL.

EDIT: your code in itself works.

Link to comment

Guys c'mon, really? Your helping is going bad way.

Probably, resource will start earlier than player will log in, so in this case we'll need to use onPlayerLogin s-side event.

teamplayer = createTeam("Jugadores", 255, 255, 255) 
  
addEventHandler("onPlayerLogin", root, 
    function ( _, account ) 
        if isGuestAccount(account) then return end 
        local accountName = getAccountName(account) 
        if not isObjectInACLGroup("user."..accountName, aclGetGroup("Anarguia")) or not isObjectInACLGroup("user."..accountName, aclGetGroup("Alianza")) then 
            setPlayerTeam(source, teamplayer) 
        end 
    end 
) 

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