knightscript Posted January 24, 2016 Share Posted January 24, 2016 Hello, im trying to show the clan tag of the players on the chatbox, im using the following code to fetch the players clan/group: function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "money") if (accountData) then playerclan = getAccountData(theCurrentAccount,"Group") end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) and on the chatbox: addEventHandler ( "onPlayerChat", root, function ( message, type ) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Everyone" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#FFFFFF*[ #000FFF"..playerclan.."#FFFFFF ]- " .. getPlayerName(source) .. ":#FFFFFF " .. message, getRootElement(), r, g, b, true ) My problem is, that the clan is the same for everyone, how can I fix this? Link to comment
knightscript Posted January 24, 2016 Author Share Posted January 24, 2016 Fixed it, just added this to my "OnPlayerChat": local playerAccount = getPlayerAccount(source) and on each chat acl I added getAccountData(playerAccount,"Group") EXAMPLE: addEventHandler ( "onPlayerChat", root, function ( message, type ) local playerAccount = getPlayerAccount(source) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Owners" ) ) and type == 0 then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) outputChatBox ( "#990000*[ #0000FF"..getAccountData(playerAccount,"Group").."]#FFFFFF- " .. getPlayerName(source) .. ":#FFFFFF " .. message, getRootElement(), r, g, b, true ) end end) Link to comment
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