-Doc- Posted March 11, 2016 Posted March 11, 2016 Why the timer check doesn't work? function not_staff ( ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Everyone" ) ) and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Moderator" ) ) and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "SuperModerator" ) ) and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Warden" ) ) and not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Vip" ) ) then setElementData( source, "Classicon", "Player" ); end end setTimer ( not_staff, 60, 0 )
SpecT Posted March 11, 2016 Posted March 11, 2016 1. You don't need to check if the player is not in the other ACL groups. Only a check for the group "Everyone" is enough. 2. When the timer triggers the function there is no source (player) 3. Because of 2. you need to loop thru all the online players Here you go: function not_staff() for i, player in ipairs(getElementsByType("player")) do if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Everyone" ) ) then setElementData( player, "Classicon", "Player" ); end end end setTimer(not_staff, 60, 0)
Moderators Citizen Posted March 11, 2016 Moderators Posted March 11, 2016 Even if toni is right, you don't want to check that every 60ms (~17 times per second)! This is an obvious waste of server resources ! I would make an updatePlayerClassIcon function instead and call it when it needs to be updated: function updatePlayerClassicon() local accName = getAccountName( getPlayerAccount( source ) ) local aclName = "user."..accName local classIcon = "Player" -- By default he has the "Player" Classicon if isObjectInACLGroup( aclName, aclGetGroup( "Admin" ) ) then classIcon = "Admin" -- Modify it if needed else if isObjectInACLGroup( aclName, aclGetGroup( "Moderator" ) ) then classIcon = "Moderator" -- Modify it if needed else if isObjectInACLGroup( aclName, aclGetGroup( "SuperModerator" ) ) then classIcon = "SuperModerator" -- Modify it if needed else if isObjectInACLGroup( aclName, aclGetGroup( "Warden" ) ) then classIcon = "Warden" -- Modify it if needed else if isObjectInACLGroup( aclName, aclGetGroup( "Vip" ) ) classIcon = "Vip" -- Modify it if needed end setElementData( source, "Classicon", classIcon ) -- setting the Classicon end addEventHandler("onPlayerJoin", root, updatePlayerClassicon) addEventHandler("onPlayerLogin", root, updatePlayerClassicon) addEventHandler("onPlayerLogout", root, updatePlayerClassicon)
-Doc- Posted March 11, 2016 Author Posted March 11, 2016 And how to get resource ram usage, because i have many resources and don't now which one makes server lag.
EstrategiaGTA Posted March 11, 2016 Posted March 11, 2016 1. You don't need to check if the player is not in the other ACL groups. Only a check for the group "Everyone" is enough. This is not true. I think he wants to do it like this: Everyone, except the Moderation Team, VIPs and whatever can use this script. If you just check if the user is within the "Everyone" group, it will work for Admins, too. However, I would use: hasObjectPermissionTo --in order to forbid any user who can kick or ban to use the script. isObjectInACLGroup --in order to forbid VIPs and such groups, too.
Mann56 Posted March 11, 2016 Posted March 11, 2016 And how to get resource ram usage, because i have many resources and don't now which one makes server lag. Use performance browser.
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