DRW Posted April 23, 2015 Posted April 23, 2015 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.
Dimos7 Posted April 23, 2015 Posted April 23, 2015 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)
DRW Posted April 23, 2015 Author Posted April 23, 2015 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
Dimos7 Posted April 23, 2015 Posted April 23, 2015 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)
DRW Posted April 23, 2015 Author Posted April 23, 2015 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)
Dimos7 Posted April 23, 2015 Posted April 23, 2015 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)
Walid Posted April 23, 2015 Posted April 23, 2015 -- 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 )
DRW Posted April 24, 2015 Author Posted April 24, 2015 -- 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
Enargy, Posted April 24, 2015 Posted April 24, 2015 -- 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.
WhoAmI Posted April 25, 2015 Posted April 25, 2015 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 )
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now