Mr.Mostafa Posted April 22, 2018 Share Posted April 22, 2018 (edited) آلسلام عليكم مود آلسبآم طبيعي لمآ آحد يسوي سبآم بآلشآت يآخد ميوت آبي آسوي آن آنآ آلوحيد آلي مآ آخد ميوت يعني لو سويت سبآم آنآ مآ آخد ميوت لكن لو آحد سوي يآخد ميوت عآدي local gPlayerTickCount = { } local gPlayerSpams = { } local gPlayerMessage = { } local gPlayerMsgNum = { } local gPlayerMuteTimer = { } local gSettings = { } addEventHandler( "onPlayerChat", getRootElement( ), function( message ) if not gPlayerSpams[ source ] then gPlayerSpams[ source ] = true gPlayerTickCount[ source ] = getTickCount( ) gPlayerMessage[ source ] = message else if getTickCount( ) - gPlayerTickCount[ source ] > gSettings.delay then gPlayerMsgNum[ source ] = 0 gPlayerMessage[ source ] = nil; gPlayerTickCount[ source ] = getTickCount( ) return else if gPlayerMsgNum[ source ] >= gSettings.msgNum then gPlayerTickCount[ source ] = getTickCount( ) cancelEvent( ) if gSettings.mutePlayers then mutePlayer( source ); end elseif message == gPlayerMessage[ source ] then cancelEvent( ) outputChatBox( "Don't repeat yourself!!!", source, 255, 0, 0 ) end gPlayerMsgNum[ source ] = gPlayerMsgNum[ source ] + 1 end end gPlayerMessage[ source ] = message end ) function mutePlayer( player ) setPlayerMuted( player, true ); gPlayerMuteTimer[ player ] = setTimer( unmutePlayer, gSettings.muteTime * 1000, 1, player ); outputChatBox( "Don't flood the chat!!! You are now muted for " .. gSettings.muteTime .." seconds.", player, 255, 0, 0 ) end function unmutePlayer( player ) setPlayerMuted( player, false ); outputChatBox( "You can talk again. Remeber, do NOT spam!", player, 255, 0, 0 ); end addEventHandler( "onPlayerJoin", getRootElement( ), function( ) gPlayerMsgNum[ source ] = 0 end ) addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function( ) gSettings.delay = get( "@differenceBetweenMessages_ms" ) gSettings.msgNum = get( "@messagesNumber" ) gSettings.mutePlayers = ( get( "@mutePlayers" ) == "true" ) and true or false; gSettings.muteTime = get( "@muteTime" ); for _, plr in pairs( getElementsByType( "player" ) ) do gPlayerMsgNum[ plr ] = 0 end end ) addEventHandler( "onResourceStop", getResourceRootElement(), function( ) local players = getElementsByType( "player" ); for i, plr in pairs( players ) do if isPlayerMuted( plr ) then setPlayerMuted( plr, false ); end end end ) Edited April 22, 2018 by Mr.Mostafa Link to comment
+Source|> Posted April 22, 2018 Share Posted April 22, 2018 3 hours ago, Mr.Mostafa said: آلسلام عليكم مود آلسبآم طبيعي لمآ آحد يسوي سبآم بآلشآت يآخد ميوت آبي آسوي آن آنآ آلوحيد آلي مآ آخد ميوت يعني لو سويت سبآم آنآ مآ آخد ميوت لكن لو آحد سوي يآخد ميوت عآدي local gPlayerTickCount = { } local gPlayerSpams = { } local gPlayerMessage = { } local gPlayerMsgNum = { } local gPlayerMuteTimer = { } local gSettings = { } addEventHandler( "onPlayerChat", getRootElement( ), function( message ) if not gPlayerSpams[ source ] then gPlayerSpams[ source ] = true gPlayerTickCount[ source ] = getTickCount( ) gPlayerMessage[ source ] = message else if getTickCount( ) - gPlayerTickCount[ source ] > gSettings.delay then gPlayerMsgNum[ source ] = 0 gPlayerMessage[ source ] = nil; gPlayerTickCount[ source ] = getTickCount( ) return else if gPlayerMsgNum[ source ] >= gSettings.msgNum then gPlayerTickCount[ source ] = getTickCount( ) cancelEvent( ) if gSettings.mutePlayers then mutePlayer( source ); end elseif message == gPlayerMessage[ source ] then cancelEvent( ) outputChatBox( "Don't repeat yourself!!!", source, 255, 0, 0 ) end gPlayerMsgNum[ source ] = gPlayerMsgNum[ source ] + 1 end end gPlayerMessage[ source ] = message end ) function mutePlayer( player ) setPlayerMuted( player, true ); gPlayerMuteTimer[ player ] = setTimer( unmutePlayer, gSettings.muteTime * 1000, 1, player ); outputChatBox( "Don't flood the chat!!! You are now muted for " .. gSettings.muteTime .." seconds.", player, 255, 0, 0 ) end function unmutePlayer( player ) setPlayerMuted( player, false ); outputChatBox( "You can talk again. Remeber, do NOT spam!", player, 255, 0, 0 ); end addEventHandler( "onPlayerJoin", getRootElement( ), function( ) gPlayerMsgNum[ source ] = 0 end ) addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function( ) gSettings.delay = get( "@differenceBetweenMessages_ms" ) gSettings.msgNum = get( "@messagesNumber" ) gSettings.mutePlayers = ( get( "@mutePlayers" ) == "true" ) and true or false; gSettings.muteTime = get( "@muteTime" ); for _, plr in pairs( getElementsByType( "player" ) ) do gPlayerMsgNum[ plr ] = 0 end end ) addEventHandler( "onResourceStop", getResourceRootElement(), function( ) local players = getElementsByType( "player" ); for i, plr in pairs( players ) do if isPlayerMuted( plr ) then setPlayerMuted( plr, false ); end end end ) سوي تحقق من سيريالك وسوي return end if getPlayerSerial(source) == "سيريالك" then return end اتوقع كذا جرب وقولي 1 Link to comment
Mr.Mostafa Posted April 22, 2018 Author Share Posted April 22, 2018 8 minutes ago, Source|> said: سوي تحقق من سيريالك وسوي return end if getPlayerSerial(source) == "سيريالك" then return end اتوقع كذا جرب وقولي سويت نفس آلكود لكن حطيته بمكآن خطآ فآ خرب آلمود تقدر تقلي آحطه بسطر كآم ؟ @Source|> Link to comment
+Source|> Posted April 22, 2018 Share Posted April 22, 2018 1 minute ago, Mr.Mostafa said: سويت نفس آلكود لكن حطيته بمكآن خطآ فآ خرب آلمود تقدر تقلي آحطه بسطر كآم ؟ @Source|> اتوقع بعد function(message) جرب Link to comment
Mr.Mostafa Posted April 22, 2018 Author Share Posted April 22, 2018 27 minutes ago, Source|> said: سوي تحقق من سيريالك وسوي return end if getPlayerSerial(source) == "سيريالك" then return end اتوقع كذا جرب وقولي 16 minutes ago, Source|> said: اتوقع بعد function(message) جرب مآ ظبط @Source|> @#DesTroeyR Link to comment
+Source|> Posted April 23, 2018 Share Posted April 23, 2018 23 hours ago, Mr.Mostafa said: مآ ظبط @Source|> @#DesTroeyR حطها بعد if not gPlayerSpams[ source ] then جرب 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