Jump to content

censorship help!


Try

Recommended Posts

Change line 415 in freeroam/fr_server.lua

addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
  if type == 0 then 
    cancelEvent() 
    local account = getPlayerAccount(source) 
    local r, g, b = getPlayerNametagColor(source) 
    local name = getPlayerName(source) 
    local msg = msg:gsub('#%x%x%x%x%x%x', '') 
    if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then   
      outputChatBox( "#FF0000[Admin]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
    elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then   
      outputChatBox( "#FF8000[Moderator]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
    elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Member' ) ) then 
      outputChatBox( "#00FF00[Member]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
   else   
      outputChatBox( "#FFFF00[Guest]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
   end 
  end 
end 
) 

Link to comment
Change line 415 in freeroam/fr_server.lua
addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
  if type == 0 then 
    cancelEvent() 
    local account = getPlayerAccount(source) 
    local r, g, b = getPlayerNametagColor(source) 
    local name = getPlayerName(source) 
    local msg = msg:gsub('#%x%x%x%x%x%x', '') 
    if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then   
      outputChatBox( "#FF0000[Admin]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
    elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then   
      outputChatBox( "#FF8000[Moderator]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
    elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Member' ) ) then 
      outputChatBox( "#00FF00[Member]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
   else   
      outputChatBox( "#FFFF00[Guest]" .. name .. '#FFFFFF: #FFFFFF' .. msg, g_Root, r, g, b, true) 
   end 
  end 
end 
) 

did you actually read my post? i said we have a chat script made not in freeroam

Link to comment
function onPlayerChatCensor(Text, Type) 
    ChatCensored = false 
     
    if Text == 'fuk' then 
        ChatCensored = true 
    end 
end 
addEventHandler('onPlayerChat', root, onPlayerChatCensor) 
  
function onPlayerChatCustom(Text, Type) 
    cancelEvent() 
    if ChatCensored then return end 
     
    outputChatBox(Text) 
end 
addEventHandler('onPlayerChat', root, onPlayerChatCustom) 

onPlayerChatCensor must be called before onPlayerChatCustom, so load censor script first, or if both are in same script call onPlayerChatCensor's addEventHandler first

Link to comment

Uisaqin, that is still a(n) (epic) fail. It's impossible if you don't use EXPORTS. Also you can use "return".

Try - I don't think The_GTA gave you the player controller to release it on the community to claim ownership, The_GTA made it all and I recommend you add him as an owner too.

Link to comment
Uisaqin, that is still a(n) (epic) fail. It's impossible if you don't use EXPORTS. Also you can use "return".

epic fail. ok.

No one mentioned anything about separate resources or exports, just separate scripts.

Dunno what your saying about using return, i was demonstrating how to stop an event's execution from another, as im guessing cancelEvent() will not stop the next event functions being called. Not that it should, of course.

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