Jump to content

حل مشكله


MA[S]RIY

Recommended Posts

السلام عليكم

addEventHandler("onPlayerChat",root,
function ( msg )
local sData = getElementData ( source, "spam" )
if sData then
cancelEvent ()
outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
else
setElementData ( source, "spam", msg )
setTimer ( function ( )
removeElementData ( source , "spam" )
end , 2000, 1 )
end
end
)

انا ابي اسوي ب ذا الكود

لما الاعب يكتب شئ بالشات

م يقدر يكتب ثاني إلا بعدها بثانيتين

يعني مود سبام

المشكله

لما اكتب اي شئ يطلع لي نص 

#[ نظام الشات ]x [00:02] انتظر متبقي

انا ابي لما اكتب شئ واجي اكتبها بعدها علطول قبل ثانيتين يطلع لي ذا النص

مو يطلعه لي اول م اكتب اي شئ

ابي حل لذي المشكله ؟

Edited by MA[S]RIY
Link to comment
addEventHandler("onPlayerChat",root,
function ( msg ) local sData = getElementData ( source, "spam" ) if sData and sData == msg then cancelEvent () outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true ) else setElementData ( source, "spam", msg ) setTimer ( function ( ) removeElementData ( source , "spam" ) end , 2000, 1 ) end end )

 

Edited by Hus[s]ain-[25]~
Link to comment

تقدر تسوي جدول للتيمر و من خلاله تتحقق

و تحقق داخل فنكشن التيمر

if ( isElement( Player ) ) then 

Player = حسب الاعب المعرف عندك

مشان ممكن بعد التايمر ممكن الاعب يكون خرج

Link to comment

 

  On 18/12/2017 at 10:56, Hus[s]ain-[25]~ said:

addEventHandler("onPlayerChat",root,
function ( msg ) local sData = getElementData ( source, "spam" ) if sData and sData == msg then cancelEvent () outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true ) else setElementData ( source, "spam", msg ) setTimer ( function ( ) removeElementData ( source , "spam" ) end , 2000, 1 ) end end )

 

Expand  

كود حق منع تكرار مو الي ابيه انا ابي اسوي مود سبام الاعب م يقدر يكتب إلا كل ثانيتين

  On 18/12/2017 at 18:04, #Soking said:

تقدر تسوي جدول للتيمر و من خلاله تتحقق

و تحقق داخل فنكشن التيمر

if ( isElement( Player ) ) then 

Player = حسب الاعب المعرف عندك

مشان ممكن بعد التايمر ممكن الاعب يكون خرج

Expand  

يعني كيف بيكون الكود ؟

Link to comment

 

local Second , Spam = 5 , { } ;
addEventHandler ( "onPlayerChat" , root , function ( msg )
if ( isTimer ( Spam [ source ] ) ) then 
outputChatBox ( "Please Wait "..(math.floor(getTimerDetails(Spam[source])/1000)),source,255,0,0,true) ;
return
end
Spam [ source ] = setTimer ( function ( ) Spam [ source ] = nil end,Second*1000,1 ) ;
--- Your Code 
end ) ;

 

  • Sad 1
Link to comment
  On 19/12/2017 at 21:58, MA[S]RIY said:

بس انا ابي اسوي مود سبام

Expand  

ديفولت سوالك واحد جديد وجاهز بس انا ما كنت بدي اياك تتعبنفسك 

ميوت قصير نفسو سامب 

  On 19/12/2017 at 21:58, Default#^ said:

getTimerDetails

Expand  

هو  سامب ما اظن لذا فايده كونو بس 2 ثواني ما رح يصل ل دقائق او ساعات

Link to comment
  On 19/12/2017 at 23:31, MA[S]RIY said:

الي سواه الاخ ديفولت ذا مود منع التكرار 

..

Expand  

طيب؟

وانت تبي انو ياخذ ميوت 2 ثواني 

طيب ما اصلن اللعبة تعطيه اربع ثواني سامب اقل شي 

"onPlayerMute"

setPlayerMuted

"onPlayerChat"

isPlayerMuted

شوف ذول يكفو وزيادة اذا السامب لشات العام

انا طرحتهم اكواد مشان تتعلم بس اذا بدك 

انا اجهز الكود 

Edited by iyaad
Link to comment

بص انا ابي بالضبط

لما الاعب يكتب شئ بالشات

ميقدر يكتب بعدها إلا بعد ثانيتين

لو كتب قبل الثانيتين يكنسل الايفنت ويطلع له نص

الثانيتين ذول ك تجربه فقط

مشكلتي الحين لما اجي اكتب يطلع لي الكلام

انا ابي يطلع لي الكلام

اذا كتبت وبعدان كتبت ثاني قبل ثانيتين من الكتابه للمره الاولي

فاهمني

Link to comment
  On 20/12/2017 at 08:52, iyaad said:

طيب؟

وانت تبي انو ياخذ ميوت 2 ثواني 

طيب ما اصلن اللعبة تعطيه اربع ثواني سامب اقل شي 


"onPlayerMute"

setPlayerMuted

"onPlayerChat"

isPlayerMuted

شوف ذول يكفو وزيادة اذا السامب لشات العام

انا طرحتهم اكواد مشان تتعلم بس اذا بدك 

انا اجهز الكود 

Expand  

سامب ولا سبام؟

Link to comment
  On 18/12/2017 at 09:30, MA[S]RIY said:

السلام عليكم

addEventHandler("onPlayerChat",root,
function ( msg )
local sData = getElementData ( source, "spam" )
if sData then
cancelEvent ()
outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
else
setElementData ( source, "spam", msg )
setTimer ( function ( )
removeElementData ( source , "spam" )
end , 2000, 1 )
end
end
)

انا ابي اسوي ب ذا الكود

لما الاعب يكتب شئ بالشات

م يقدر يكتب ثاني إلا بعدها بثانيتين

يعني مود سبام

المشكله

لما اكتب اي شئ يطلع لي نص 

#[ نظام الشات ]x [00:02] انتظر متبقي

انا ابي لما اكتب شئ واجي اكتبها بعدها علطول قبل ثانيتين يطلع لي ذا النص

مو يطلعه لي اول م اكتب اي شئ

ابي حل لذي المشكله ؟

Expand  

ملخص القصة اللي فهمتو منك

ملاحظة الكود غير مجرب

local texts={}
local times={}
local sec=2
addEventHandler("onPlayerChat",root,
function ( msg )
   	 for k,v in ipairs(texts) do
    	if v.plr==source then 
        	table.insert(v.text,msg)
        		outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
                  for k,v in ipairs(v.text)do
          if k~=1 then
        			setTimer(function(source,msg)
                 	 	outputChatBox(getPlayerName(source)..' : '..msg,root,255,255,255,true)
                for s,g in ipairs(texts)do
                  if g.plr==source then
            				for k,v in ipairs(v.text)do
              					if v.text==msg then
                					table.remove(v.text,k)
              					end
            				end
                		end
                  end
        			  	end,(tonumber(k)*sec*1000),1,source,msg)
          			end
                   end
        			cancelEvent ()
        	return
     	 end
     end
    if times[source]~=nil then
		cancelEvent ()
		outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
      table.insert(texts,{plr=source,text={msg}})
      times[source]=setTimer(function(source,msg)
        outputChatBox(getPlayerName(source)..' : '..msg,root,255,255,255,true)
          timers[source]=nil
        end,1000*sec,1,source,msg)
		end
    end
end
)

 

والله يشباب حاولت ارتب الكود لكن مافي امل معرف ارتب ههههههه

xD

 

Edited by Master_MTA
Link to comment

 

  On 20/12/2017 at 13:04, Master_MTA said:

ملخص القصة اللي فهمتو منك

ملاحظة الكود غير مجرب


local texts={}
local times={}
local sec=2
addEventHandler("onPlayerChat",root,
function ( msg )
   	 for k,v in ipairs(texts) do
    	if v.plr==source then 
        	table.insert(v.text,msg)
        		outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
                  for k,v in ipairs(v.text)do
          if k~=1 then
        			setTimer(function(source,msg)
                 	 	outputChatBox(getPlayerName(source)..' : '..msg,root,255,255,255,true)
                for s,g in ipairs(texts)do
                  if g.plr==source then
            				for k,v in ipairs(v.text)do
              					if v.text==msg then
                					table.remove(v.text,k)
              					end
            				end
                		end
                  end
        			  	end,(tonumber(k)*sec*1000),1,source,msg)
          			end
                   end
        			cancelEvent ()
        	return
     	 end
     end
    if times[source]~=nil then
		cancelEvent ()
		outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
      table.insert(texts,{plr=source,text={msg}})
      times[source]=setTimer(function(source,msg)
        outputChatBox(getPlayerName(source)..' : '..msg,root,255,255,255,true)
          timers[source]=nil
        end,1000*sec,1,source,msg)
		end
    end
end
)

 

والله يشباب حاولت ارتب الكود لكن مافي امل معرف ارتب ههههههه

xD

 

Expand  

السلام عليكم

الكود م يسوي اي شئ ؟

Link to comment
  On 20/12/2017 at 13:04, Master_MTA said:

ملخص القصة اللي فهمتو منك

ملاحظة الكود غير مجرب


local texts={}
local times={}
local sec=2
addEventHandler("onPlayerChat",root,
function ( msg )
   	 for k,v in ipairs(texts) do
    	if v.plr==source then 
        	table.insert(v.text,msg)
        		outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
                  for k,v in ipairs(v.text)do
          if k~=1 then
        			setTimer(function(source,msg)
                 	 	outputChatBox(getPlayerName(source)..' : '..msg,root,255,255,255,true)
                for s,g in ipairs(texts)do
                  if g.plr==source then
            				for k,v in ipairs(v.text)do
              					if v.text==msg then
                					table.remove(v.text,k)
              					end
            				end
                		end
                  end
        			  	end,(tonumber(k)*sec*1000),1,source,msg)
          			end
                   end
        			cancelEvent ()
        	return
     	 end
     end
    if times[source]~=nil then
		cancelEvent ()
		outputChatBox ("#[ نظام الشات ]x [00:02] انتظر متبقي",source, 255, 0, 0, true )
      table.insert(texts,{plr=source,text={msg}})
      times[source]=setTimer(function(source,msg)
        outputChatBox(getPlayerName(source)..' : '..msg,root,255,255,255,true)
          timers[source]=nil
        end,1000*sec,1,source,msg)
		end
    end
end
)

 

والله يشباب حاولت ارتب الكود لكن مافي امل معرف ارتب ههههههه

xD

 

Expand  

 

  On 21/12/2017 at 06:56, MA[S]RIY said:

 

السلام عليكم

الكود م يسوي اي شئ ؟

Expand  

ي ساتر منكم خلاص دفولت اختصر السالفة

انت ماتبيه يكتب الا بعد ثانيتين بدل رقم 5 الموجود بكود دفولت بـ 2 وانتهت السالفة ..
 

  On 19/12/2017 at 21:58, Default#^ said:

 


local Second , Spam = 5 , { } ;
addEventHandler ( "onPlayerChat" , root , function ( msg )
if ( isTimer ( Spam [ source ] ) ) then 
outputChatBox ( "Please Wait "..(math.floor(getTimerDetails(Spam[source])/1000)),source,255,0,0,true) ;
return
end
Spam [ source ] = setTimer ( function ( ) Spam [ source ] = nil end,Second*1000,1 ) ;
--- Your Code 
end ) ;

 

Expand  

 

Link to comment
  On 21/12/2017 at 14:59, iMr.WiFi..! said:

ي ساتر منكم خلاص دفولت اختصر السالفة

 

Expand  

 

  On 20/12/2017 at 09:45, MA[S]RIY said:

اذا كتبت وبعدان كتبت ثاني قبل ثانيتين من الكتابه للمره الاولي

 

Expand  

ديفولت ما سوا طلبة

  On 21/12/2017 at 06:56, MA[S]RIY said:

الكود م يسوي اي شئ ؟

Expand  

دي بق

Link to comment
  On 22/12/2017 at 17:45, MA[S]RIY said:

م طلع شئ

 

--

يعني الحين لو استخدمت كود ديفولت بيكون تمام

وهو كاتب لي 

--- Your Code

يقصد اكتب كودي  الي انا مسويه ولا ايش ؟

Expand  

انت تبيه ما يقدر يتكلم بالشات لمدة ثانيتين استخدم كود ديفولت اما كودي سالفته اكبر بشوي

بحيث لما تتكلم ثاني بالشات خلال ثانيتين

يقوم بتاجيل الرساله حقتك ثانيتين ثم يظهرها بالشات

Link to comment
timeSpam = 2 * 1000 
tableSpam = {}
tableSpam_T = {}

addEventHandler("onPlayerChat",root,
function ( player, msg )
	tableSpam[player] = true
	tableSpam_T[player] = setTimer(function(p) if p then tableSpam[p] = nil tableSpam_T[p] = nil end end,timeSpam,1,player)
		if tableSpam[player] == true then
			if isTimer(tableSpam_T[player]) then
				local time,_,__ = getTimerDetails(tableSpam_T[player])
				cancelEvent ()
				outputChatBox("Stop spamming local chat!, wait "..math.floor(time/1000,2).." seconds.", player, 255, 0, 0)
			end
		end
	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...