Jump to content

Freeroam Chatbox Script


Recommended Posts

Posted

Hello all, i require some help, i was roaming through the freeroam script could not help but find this:

addEventHandler('onPlayerChat', g_Root, 
 function(msg, type) 
  if type == 0 then 
   cancelEvent() 
   local r, g, b = getPlayerNametagColor(source) 
   outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
   outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) 
  end 
 end 
) 

Well i am not a good scripter, but if i believe this is the source of the outputs in chat, for an example, i wanted to put the ACL group before the name (ADMIN) (MODERATOR) (SUPER MODERATOR) I looked through the wiki and found this aclGetGroup, but is it possible to put in the code. So aclGetGroup(source) would be before getplayername(source).

addEventHandler('onPlayerChat', g_Root, 
 function(msg, type) 
  if type == 0 then 
   cancelEvent() 
   local r, g, b = getPlayerNametagColor(source) 
   outputChatBox(aclGetGroup(source) .. getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
   outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) 
  end 
 end 
) 

But when i do it, it disables the chat completely, i assume maybe i am inserting it wrongly. Could someone please direct me?

Posted

because aclGetGroup returns ACL group, getting it by group name.

right now your use of this function is just random.

Posted

But, objects (players) can be in multiple groups. You should check if the player's account is in a group using isObjectInACLGroup, and give priority to the most important one.

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