Jump to content

spam command "kill"


Recommended Posts

سلام عليكم

وش الخطا في الكود هادا

يكتب لا تكرر والاعب يموت بعد

ما يسوي cancelEvent

local tapleMrat = {}


addEventHandler("onPlayerCommand",root,
    function(command)
	local num = tapleMrat[source] or 0
	if (command == "kill") then
	if tapleMrat[source] then
		
	cancelEvent() 
	outputChatBox("لا تكرر",source,255,0,0,true)
	
	end
	   tapleMrat[source] = true
	   plr = source
	   	setTimer(function()
			tapleMrat[plr] = nil
		end,8000,1,plr)
	end
end)

 

Link to comment
1 hour ago, Mr.Mostafa said:

سلام عليكم

وش الخطا في الكود هادا

يكتب لا تكرر والاعب يموت بعد

ما يسوي cancelEvent


local tapleMrat = {}


addEventHandler("onPlayerCommand",root,
    function(command)
	local num = tapleMrat[source] or 0
	if (command == "kill") then
	if tapleMrat[source] then
		
	cancelEvent() 
	outputChatBox("لا تكرر",source,255,0,0,true)
	
	end
	   tapleMrat[source] = true
	   plr = source
	   	setTimer(function()
			tapleMrat[plr] = nil
		end,8000,1,plr)
	end
end)

 

مافيه خطأ , الكود كذا شغلته , انت وش الفكره اللي تبغى توصل لها ؟

Link to comment
4 hours ago, NX_CI said:

مافيه خطأ , الكود كذا شغلته , انت وش الفكره اللي تبغى توصل لها ؟

 

5 hours ago, Mr.Mostafa said:

يكتب لا تكرر والاعب يموت بعد

ما يسوي cancelEvent

ابيه ما يموت

Edited by Mr.Mostafa
Link to comment
local SpamTime = 5000
local SpamTimer = { }
local Commands = {
    [ "kill" ] = true,
}

addEventHandler ( "onPlayerCommand" , root , function ( Command )
    if Commands [ Command ] then
        if not SpamTimer [ source ] then
            SpamTimer [ source ] = { }
        end
        if SpamTimer [ source ] [ Command ] and isTimer ( SpamTimer [ source ] [ Command ] ) then
            outputChatBox ( " Please stop spaming " , source , 255 , 0 , 0 , true )
            cancelEvent ( )
            return
        end
        SpamTimer [ source ] [ Command ] = setTimer (
            function ( source )
                SpamTimer [ source ] [ Command ] = false
            end 
        , SpamTime , 1 , source )
    end
end )
    

not tested

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