Jump to content

Admin Warn


xXGhostXx

Recommended Posts

1 minute ago, iMr.WiFi..! said:

addEventHandler("onPlayerChat", root, function ( message ) 
	if( message:find( ".com" ) )then
		outputChatBox('Found .com in your message', source, 255, 255, 255, false );
	end
end )

This is just example, You need to make it by your self.

No !

i want for found message send to admin acl !

[ADM-Warn]: xXGhostXx : google.com For test

Link to comment
7 minutes ago, iMr.WiFi..! said:

Then use loop with next function :
 


getPlayersInGroup -- Usefull function.

 

function awarn (message)
if not ( isPlayerOnGroup ( thePlayer ) ) then
    return false
end
	local filter = message find( ".com" )
	if( message:find( ".com" ) )then
		outputChatBox("#ff0000[ADM-Warn]:" ..getPlayerFromName.. ": " ..filter.. "**", source, 255, 255, 255, true )
	end
end
addEventHandler("onPlayerChat", root, awarn)

Please debug my code ❤️

Link to comment
function getPlayersInGroup ( GroupName )
 
    local aTable = {}
 
    assert ( tostring ( GroupName ) , "Bad Argument At Argument #1 Group Moust String" )
   
    assert ( aclGetGroup ( tostring ( GroupName ) ) , "Bad Argument At Argument #1 Group not Found "  )
   
    for i , player_ in ipairs ( getElementsByType ( "player" ) ) do
   
    local TheAcc =  getPlayerAccount ( player_ )
   
    if not isGuestAccount ( TheAcc ) then  
 
    if isObjectInACLGroup ( "user." ..getAccountName ( TheAcc ) , aclGetGroup ( tostring ( GroupName ) ) ) then
     
    table.insert ( aTable , player_ )
             end  
        end
    end 
    return aTable
end
Words = { 
	".com",
	".org"
}
addEventHandler("onPlayerChat", root, function ( message ) 
	for _, word in ipairs(Words) do
		if( message:find( word ) )then
			for _, player in ipairs(getPlayersInGroup( 'Admin' )) do
				outputChatBox("#ff0000[ADM-Warn]:" ..getPlayerName(source).. ": " ..message.. "**", player, 255, 255, 255, true )
			end
			break;
		end
	end
end )

 

Edited by iMr.WiFi..!
Link to comment
6 minutes ago, iMr.WiFi..! said:

function getPlayersInGroup ( GroupName )
 
    local aTable = {}
 
    assert ( tostring ( GroupName ) , "Bad Argument At Argument #1 Group Moust String" )
   
    assert ( aclGetGroup ( tostring ( GroupName ) ) , "Bad Argument At Argument #1 Group not Found "  )
   
    for i , player_ in ipairs ( getElementsByType ( "player" ) ) do
   
    local TheAcc =  getPlayerAccount ( player_ )
   
    if not isGuestAccount ( TheAcc ) then  
 
    if isObjectInACLGroup ( "user." ..getAccountName ( TheAcc ) , aclGetGroup ( tostring ( GroupName ) ) ) then
     
    table.insert ( aTable , player_ )
             end  
        end
    end 
    return aTable
end
Words = { 
	".com",
	".org"
}
addEventHandler("onPlayerChat", root, function ( message ) 
	for _, word in ipairs(Words) do
		if( message:find( word ) )then
			for _, player in ipairs(getPlayersInGroup( 'Admin' )) do
				outputChatBox("#ff0000[ADM-Warn]:" ..getPlayerName(source).. ": " ..message.. "**", player, 255, 255, 255, true )
			end
			break;
		end
	end
end )

 

For this code use  acl on group ?

if not ( isPlayerOnGroup ( thePlayer ) ) then
    return false
end

 

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