Jump to content

حفظ الميوت


emad10

Recommended Posts

جرب زي كذآ طيب !

Server

words = { 'Word1', -- غير الكلمآت اللي تبيهم  
        'word2', -- وهنا 
        'Word3', -- وهنا 
        'Word4' -- وهنا 
} 
  
g_resRoot = getResourceRootElement( getThisResource()) 
  
addEventHandler( "onResourceStart", g_resRoot, 
function() 
    for k, v in ipairs( getElementsByType ( "player" ) ) do 
    setElementData( g_resRoot, ""..getPlayerSerial( v )..".muted", false ) 
    end         
end 
) 
  
addEventHandler( "onPlayerChat", root, 
function ( msg, type ) 
    for k, i in pairs( words ) do 
    if string.find( msg, i ) then 
        cancelEvent() 
        local data = getElementData( g_resRoot, ""..getPlayerSerial( source )..".muted" ) 
        if  data == false then 
            if type == 0 then                 
                local playerName = getPlayerName( source ):gsub( "#%x%x%x%x%x%x", "" ) 
                setPlayerMuted( source, true ) 
                setElementData( g_resRoot, ""..getPlayerSerial( source )..".muted", true ) 
                outputChatBox("*".. playerName .." Has Been Muted By Console (1 min) [REASON : Requst Admin.]", root, 255, 0, 0 ) 
                outputChatBox("* You Have Been Muted By Console (1 min) [REASON : Requst Admin.]", source, 255, 0, 0 ) 
                setTimer( setPlayerMuted, 100000, 1, source, false ) 
                setTimer( setElementData, 100000, 1, g_resRoot,""..getPlayerSerial( source )..".muted",false)  
                setTimer( outputChatBox, 100000, 1, "*".. playerName .." Has Been Unmuted By Console.", root, 0, 255, 90 )      
                setTimer( outputChatBox, 100000, 1, "* You Have Been Unmuted By Console.", source, 0, 255, 90 )  
            else return end 
            end 
        end                 
    end 
end 
) 
  
addEventHandler( "onPlayerJoin", root, 
function() 
    if getElementData( g_resRoot, ""..getPlayerSerial(source)..".muted" ) == true then 
        setPlayerMuted( source, true )                 
        else 
        setElementData( g_resRoot, ""..getPlayerSerial( source )..".muted", false )         
    end 
end 
) 

Link to comment

جرب زي كذآ طيب !

Server

words = { 'Word1', -- غير الكلمآت اللي تبيهم  
        'word2', -- وهنا 
        'Word3', -- وهنا 
        'Word4' -- وهنا 
} 
  
g_resRoot = getResourceRootElement( getThisResource()) 
  
addEventHandler( "onResourceStart", g_resRoot, 
function() 
    for k, v in ipairs( getElementsByType ( "player" ) ) do 
    setElementData( g_resRoot, ""..getPlayerSerial( v )..".muted", false ) 
    end         
end 
) 
  
addEventHandler( "onPlayerChat", root, 
function ( msg, type ) 
    for k, i in pairs( words ) do 
    if string.find( msg, i ) then 
        cancelEvent() 
        local data = getElementData( g_resRoot, ""..getPlayerSerial( source )..".muted" ) 
        if  data == false then 
            if type == 0 then                 
                local playerName = getPlayerName( source ):gsub( "#%x%x%x%x%x%x", "" ) 
                setPlayerMuted( source, true ) 
                setElementData( g_resRoot, ""..getPlayerSerial( source )..".muted", true ) 
                outputChatBox("*".. playerName .." Has Been Muted By Console (1 min) [REASON : Requst Admin.]", root, 255, 0, 0 ) 
                outputChatBox("* You Have Been Muted By Console (1 min) [REASON : Requst Admin.]", source, 255, 0, 0 ) 
                setTimer( setPlayerMuted, 100000, 1, source, false ) 
                setTimer( setElementData, 100000, 1, g_resRoot,""..getPlayerSerial( source )..".muted",false)  
                setTimer( outputChatBox, 100000, 1, "*".. playerName .." Has Been Unmuted By Console.", root, 0, 255, 90 )      
                setTimer( outputChatBox, 100000, 1, "* You Have Been Unmuted By Console.", source, 0, 255, 90 )  
            else return end 
            end 
        end                 
    end 
end 
) 
  
addEventHandler( "onPlayerJoin", root, 
function() 
    if getElementData( g_resRoot, ""..getPlayerSerial(source)..".muted" ) == true then 
        setPlayerMuted( source, true )                 
        else 
        setElementData( g_resRoot, ""..getPlayerSerial( source )..".muted", false )         
    end 
end 
) 

I tested it , it works fine but he needs to add this line at acl ( admin group )

just edited SCRIPTNAME to your Script Name.

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