Sign in to follow this  
Yurigarga

Help GetPlayerSerial

Recommended Posts

What Should I DO ?

LDQQ9j.png

 

 

function spamEngelle(oyuncu,deger) -- spam engelleme fonksiyon
	local serial = getPlayerSerial(oyuncu)
	if deger == "Mutele" then
		outputChatBox(getPlayerName(oyuncu).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(oyuncu, true)
		setTimer (spamEngelle, 60000, 1, oyuncu, "Mute Kaldır")
		muteliler[serial] = true
	elseif deger == "Mute Kaldır" then	
		if  isElement (oyuncu) and isPlayerMuted (oyuncu)  then
			setPlayerMuted ( oyuncu, false )
			antiSpam[oyuncu] = nil
			muteliler[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( oyuncu ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
		else
			antiSpam[oyuncu] = nil
		end
	end	
end

 

Share this post


Link to post

Could you explain what you're trying to do and what doesn't work exactly with what you did?

 

Share this post


Link to post
6 minutes ago, Galactix said:

Could you explain what you're trying to do and what doesn't work exactly with what you did?

 

function spamEngelle(player,deger) -- spam blocking function
	local serial = getPlayerSerial(player)
	if deger == "Mutele" then
		outputChatBox(getPlayerName(player).."#CC0000 60 #FFFFFFsecond suspended. #CC0000Reason: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(player, true)
		setTimer (spamEngelle, 60000, 1, player, "Mute Kaldır")
		muteliler[serial] = true
	elseif deger == "Mute Kaldır" then	
		if  isElement (player) and isPlayerMuted (player)  then
			setPlayerMuted ( player, false )
			antiSpam[player] = nil
			muteliler[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #66FF00criminal its over.",root, 255, 255, 0,true )
		else
			antiSpam[player] = nil
		end
	end	
end

how can i fix the error ı have?

 

Edited by Yurigarga

Share this post


Link to post

I get that, but what error do you get with your script? I Don't know Turkish so I just know the script is about spam and mute but that's it, so try to explain your error exactly

  • Like 1

Share this post


Link to post
4 minutes ago, Galactix said:

I get that, but what error do you get with your script? I Don't know Turkish so I just know the script is about spam and mute but that's it, so try to explain your error exactly

function spamBlock(player,deger) -- spam blocking function
	local serial = getPlayerSerial(player)
	if value == "Mute" then
		outputChatBox(getPlayerName(player).."#CC0000 60 #FFFFFFSecond suspended. #CC0000Reason: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(player, true)
		setTimer (spamBlock, 60000, 1, player, "Mute Remove")
		silenced[serial] = true
	elseif value == "Mute Remove" then	
		if  isElement (player) and isPlayerMuted (player)  then
			setPlayerMuted ( player, false )
			antiSpam[player] = nil
			silenced[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #66FF00Criminal its over.",root, 255, 255, 0,true )
		else
			antiSpam[player] = nil
		end
	end	
end

can you look again ?

Share this post


Link to post
function spamEngelle(oyuncu,deger) -- spam engelleme fonksiyon
	local serial = getPlayerSerial(oyuncu)
	if deger == "Mutele" then
		outputChatBox(getPlayerName(oyuncu).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(oyuncu, true)
		setTimer (spamEngelle, 60000, 1, oyuncu, "Mute Kaldır")
		muteliler[serial] = true
	elseif deger == "Mute Kaldır" then	
		if  isElement (oyuncu) and isPlayerMuted (oyuncu)  then
			setPlayerMuted ( oyuncu, false )
			antiSpam[oyuncu] = nil
			muteliler[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( oyuncu ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
		else
			antiSpam[oyuncu] = nil
		end
	end	
end
addEventHandler( "onPlayerChat", getRootElement(), spamEngelle )

 

  • Like 1

Share this post


Link to post
6 minutes ago, Galactix said:

function spamEngelle(oyuncu,deger) -- spam engelleme fonksiyon
	local serial = getPlayerSerial(oyuncu)
	if deger == "Mutele" then
		outputChatBox(getPlayerName(oyuncu).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(oyuncu, true)
		setTimer (spamEngelle, 60000, 1, oyuncu, "Mute Kaldır")
		muteliler[serial] = true
	elseif deger == "Mute Kaldır" then	
		if  isElement (oyuncu) and isPlayerMuted (oyuncu)  then
			setPlayerMuted ( oyuncu, false )
			antiSpam[oyuncu] = nil
			muteliler[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( oyuncu ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
		else
			antiSpam[oyuncu] = nil
		end
	end	
end
addEventHandler( "onPlayerChat", getRootElement(), spamEngelle )

 

I tried and got this error

mo4MGY.png

 

"benim tag oldumu" ---->Chat writing

Share this post


Link to post
21 minutes ago, Galactix said:

debugscript'ten tam hata verebilir misiniz?

the whole of the error

 

mo4MGY.png   :(

 

server.lua

local taglar = {}
local hizliYazma = {}
local ayniMesaj = {} 
local antiSpam = {}
local serialler = {}
local muteliler = {}
local hak = {}

local ayarlar = { -- meta.xml den çekilen ayarlar
	excludedGroups = get"ExcludedGroups" or {},
	mesajGorme = get"MesajGorme" or "true",
	spamKoruma = get"SpamKoruma" or "true",
	kisaltmaMesaj = get"KisaltmaMesaj" or "true",
	reklamKoruma = get"ReklamKoruma" or "true",
	yasakliKelimeler = get"blacklistedStrings" or {},
}

addEventHandler('onPlayerChat', root ,function(text,typechat) -- chat eventi
	cancelEvent()
	local isim = getPlayerName(source)
	local r, g, b = getPlayerNametagColor(source) or math.random(0,255), math.random(0,255), math.random(0,255)
	local oyuncuTag = oyuncununTaginiCek(source)
	local randomID = math.random ( 1, #yazilar )
	local yazi = yazilar[randomID]
	local serial = getPlayerSerial(source)
	if serialler[serial]  then return end

	-- spam koruma
	if ayarlar.spamKoruma then
		if not isPlayerExcluded(source) then
			if isTimer(antiSpam[source]) then
				cancelEvent()  
				spamEngelle(source,"Mutele")
			else
				antiSpam[source] = setTimer(function(oyuncu) 
					antiSpam[oyuncu] = nil 
				end, 1000, 1, source) 
			end
		end	
	end	
	
	-- reklam koruma
	if ayarlar.reklamKoruma then
		if isAdvertisement(text) then
			if not isPlayerExcluded(source) then
				for i, yetkililer in ipairs (getElementsByType("player")) do
					if isPlayerExcluded(yetkililer) then
						if text == yazi then return end
						if ayarlar.mesajGorme then
							outputChatBox("#000000[#FF0000REKLAM UYARI#000000] " .. isim ..  " #FF0000İsimli oyuncu reklam yaptı: #FFFFFF" .. text, yetkililer, 255, 255, 255, true)
							outputServerLog("[ReklamUyari] " .. isim:gsub('#%x%x%x%x%x%x', '') .. ": " .. text)
						end
					end	
				end
				if hakVer(source) then
					text =  yazi
				else
					text =  yazi
					spamEngelle(source,"Mutele")
				end	
			end	
		end
	end	
	
	-- hızlı yazma koruma
    if hizliYazma[source] and hizliYazma[source]  > getTickCount() then
			outputChatBox("Teker teker yazınız!", source, 255, 0, 0)
        return
    else
        hizliYazma[source] = getTickCount()
    end
	
	-- aynı mesaj engelleme
    if ayniMesaj[source] and ayniMesaj[source] == text then
		outputChatBox("Aynı kelimeleri tekrarlamayınız!", source, 255, 0, 0)
		return
    else
        ayniMesaj[source] = text
    end
		
	-- kısaltma mesajlar
	if ayarlar.kisaltmaMesaj then
		for i,v in pairs ( mesajTablo ) do
			for k,t in pairs(i) do
				if text:lower() == t then
					text = v
				end
			end	
		end
	end	
	
	if typechat == 2 then cancelEvent() end -- eğer Y den yazmışsa iptal et
	
	if typechat == 0 then -- eğer T den yazmış ise
		if oyuncuYetkilimi(source) then -- eğer oyuncu yetkili ise
			local tag,chat = oyuncuYetkilimi(source) -- yetkinin tagını ve chat renklerini çek
			outputChatBox(tag..isim..chat..text, root, r, g, b, true ) -- chate aktar
		elseif oyuncuTag then -- eğer oyuncu panelden tag almışsa
			outputChatBox(oyuncuTag.." "..isim.."#FFFFFF:#ededed "..text, root, r, g, b, true ) -- chate aktar
		else --eğer yukardakilerden ikiside yoksa
			outputChatBox(""..isim.."#FFFFFF:#FFFFFF "..text, root, r, g, b, true ) -- chate yolla
		end
	end	

	outputServerLog( "CHAT: "  .. isim:gsub('#%x%x%x%x%x%x', '').. ": " .. text )	
	--exports.ChatBubbles:outputMessage(source, text)
end) 

-- Kullanışlı Fonskiyonlar ve diğer olaylar

function oyuncuYetkilimi(oyuncu) --oyuncu yetkilimi fonksiyon
	if isElement(oyuncu)  then	
		local hesapismi = getAccountName(getPlayerAccount(oyuncu))
		for i,yetkiler in pairs(yetkiliTaglar) do
			local acl,tag,chat = unpack(yetkiler)
			if aclGetGroup(acl) and isObjectInACLGroup("user." .. hesapismi, aclGetGroup(acl)) then
				return tag,chat
			end	
		end	
	end
	return false
end

function oyuncununTaginiCek(oyuncu) -- oyuncunun tagını çekme fonksiyon
	if taglar[oyuncu] then
		return taglar[oyuncu]
	else
		return false
	end
end	

function isAdvertisement(str) -- export fonksiyon (eğer kelime reklam ise)
	assert(type(str) == "string", "Bad argument 1 @ isAdvertisement [String expected, got " .. type(str) .. "]")
    local str = string.gsub(str, '#%x%x%x%x%x%x', '')
	local workingWord   = string.lower(str):gsub("[_-;:µ|><!^#'%%!§$\\&/()=._-,-#+}{ ]", '').."-";
        for index, sBadWord in pairs(ayarlar.yasakliKelimeler) do
            local pattern       = workingWord:match(".*"..string.lower(sBadWord).."*.");
            if(pattern) then    
                return sBadWord
            end
        end

	if str:find("(%d+)%.(%d+)%.(%d+)%.(%d+)") then
		return true
	end
	
	return false
end

function isPlayerExcluded(player) -- eğer oyuncu yetkili ise
	local size = #ayarlar.excludedGroups
	if size ~= 0 then
		local accountName = getAccountName(getPlayerAccount(player))
		for i=1, size do
			if isObjectInACLGroup("user." .. accountName, aclGetGroup(ayarlar.excludedGroups[i])) then
				return true
			end
		end
	end
	return false
end

addEventHandler("onPlayerConnect", root, function(playerNick, _, _, playerSerial, _)  -- oyuncu servera girince ilk 10sn. konuşmama
	serialler[playerSerial] = true 
	setTimer(function() 
		serialler[playerSerial] = nil
	end, 1000*10,1)
end)

function hakVer(oyuncu) -- Yasaklı kelime yazınca 3 hak verme
	if not hak[oyuncu] then
		hak[oyuncu] = 1
		outputChatBox("#FFFFFFYasaklı bir kelime yazdın. #CC00002 #FFFFFFhakkın kaldı.", oyuncu, 255,0,0, true)
		return true
	else
		hak[oyuncu] = hak[oyuncu]+1
		if hak[oyuncu] and hak[oyuncu]  > 2 then
			hak[oyuncu] = nil
			return false
		end
		outputChatBox("#FFFFFFYasaklı bir kelime yazdın. #CC0000"..tostring(hak[oyuncu]-1).." #FFFFFFhakkın kaldı.", oyuncu, 255,0,0, true)
		return true
	end
end

function spamEngelle(oyuncu,deger) -- spam engelleme fonksiyon
	local serial = getPlayerSerial(oyuncu)
	if deger == "Mutele" then
		outputChatBox(getPlayerName(oyuncu).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(oyuncu, true)
		setTimer (spamEngelle, 60000, 1, oyuncu, "Mute Kaldır")
		muteliler[serial] = true
	elseif deger == "Mute Kaldır" then	
		if  isElement (oyuncu) and isPlayerMuted (oyuncu)  then
			setPlayerMuted ( oyuncu, false )
			antiSpam[oyuncu] = nil
			muteliler[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( oyuncu ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
		else
			antiSpam[oyuncu] = nil
		end
	end	
end

addEventHandler("onPlayerJoin", root, function() -- muteli iken oyundan çıktığında tekrar muteleme
	local serial = getPlayerSerial(source)
	if muteliler[serial] then
		spamEngelle(source,"Mutele")	
	end
end)

addEventHandler("onPlayerQuit", root, function()
	if taglar[source] then taglar[source] = nil end
end)

addEvent("TagPanel:TagAyarla", true)
addEventHandler("TagPanel:TagAyarla", root, function(chat,olay)
	if olay == "Değiştir" then
		taglar[source] = chat
		outputChatBox("#FFFFFFTagın "..chat.." #FFFFFFolarak değiştirildi", source, 255,0,0, true)
	elseif olay == "Sıfırla" then
		taglar[source] = nil
		outputChatBox("#FFFFFFTagını başarıyla sıfırladın.", source, 255,0,0, true)
	end	
end)

 

Edited by Yurigarga

Share this post


Link to post

You need to give me the exact line of the error aswell as the argument arkadas 

Share this post


Link to post

O.o I not speak the Turkish xD, but if I am correct you are having troubles retrieving a players serial...

For me your script is EXTREMELY confusing as I only speak English...  So all I can tell you for now is to look at the returns from your event handlers.  That and also to make sure you get the players account/element data (or whatever you use), so that you can pass it into the function.

Please use /debugscript 3 and then we can get a better idea of the error...  What line is the error coming from?  What error are you getting?  And finally what are you doing when you get this error?  Please write back in English or use google translate. :P

  • Thanks 1
  • Haha 1

Share this post


Link to post

warning:server.lua:187 Bad argument "getPlayerserial" {Expected player at argumant 1 , got string "benim tag oldumu"

 

benim tag oldumu" ---->Chat writing

can you look again ?

Share this post


Link to post

Is that the whole script?  It seems that you have passed a string to the spamEngelle function, so "oyuncu" is now a string of text and not the player element.  Are you using a command to trigger that function?  Keep in mind I still have no idea at all what you are trying to do with this script...  As I do not speak Turkish.  But I will try and help.

Edited by kieran
  • Like 1

Share this post


Link to post
local tags = {}
local fastWrite = {}
local someMessage = {} 
local antiSpam = {}
local serials = {}
local muteliler = {}
local due = {}

local ayarlar = { -- meta.xml den çekilen ayarlar
	excludedGroups = get"ExcludedGroups" or {},
	mesajGorme = get"MesajGorme" or "true",
	spamKoruma = get"SpamKoruma" or "true",
	kisaltmaMesaj = get"KisaltmaMesaj" or "true",
	reklamKoruma = get"ReklamKoruma" or "true",
	yasakliKelimeler = get"blacklistedStrings" or {},
}

addEventHandler('onPlayerChat', root ,function(text,typechat) -- chat eventi
	cancelEvent()
	local isim = getPlayerName(source)
	local r, g, b = getPlayerNametagColor(source) or math.random(0,255), math.random(0,255), math.random(0,255)
	local playerTag = playerTagDraw(source)
	local randomID = math.random ( 1, #articles )
	local article = articles[randomID]
	local serial = getPlayerSerial(source)
	if serials[serial]  then return end

	-- spam protection
	if ayarlar.spamKoruma then
		if not isPlayerExcluded(source) then
			if isTimer(antiSpam[source]) then
				cancelEvent()  
				spamBlock(source,"Mutele")
			else
				antiSpam[source] = setTimer(function(player) 
					antiSpam[player] = nil 
				end, 1000, 1, source) 
			end
		end	
	end	
	
	-- advertisement protection
	if ayarlar.reklamKoruma then
		if isAdvertisement(text) then
			if not isPlayerExcluded(source) then
				for i, yetkililer in ipairs (getElementsByType("player")) do
					if isPlayerExcluded(yetkililer) then
						if text == article then return end
						if ayarlar.mesajGorme then
							outputChatBox("#000000[#FF0000WARNİNG#000000] " .. isim ..  " #FF0000the player made an ad: #FFFFFF" .. text, yetkililer, 255, 255, 255, true)
							outputServerLog("[ReklamUyari] " .. isim:gsub('#%x%x%x%x%x%x', '') .. ": " .. text)
						end
					end	
				end
				if giveChance(source) then
					text =  article
				else
					text =  article
					spamBlock(source,"Mutele")
				end	
			end	
		end
	end	
	
	-- fast write protection
    if fastWrite[source] and fastWrite[source]  > getTickCount() then
			outputChatBox("write one by one!", source, 255, 0, 0)
        return
    else
        fastWrite[source] = getTickCount()
    end
	
	-- someMessage protection
    if someMessage[source] and someMessage[source] == text then
		outputChatBox("do not write the same words!!", source, 255, 0, 0)
		return
    else
        someMessage[source] = text
    end
		
	-- abbreviation message
	if ayarlar.kisaltmaMesaj then
		for i,v in pairs ( mesajTablo ) do
			for k,t in pairs(i) do
				if text:lower() == t then
					text = v
				end
			end	
		end
	end	
	
	if typechat == 2 then cancelEvent() end -- eğer Y den yazmışsa iptal et
	
	if typechat == 0 then -- eğer T den yazmış ise
		if playerYetkilimi(source) then -- eğer player yetkili ise
			local tag,chat = playerYetkilimi(source) -- yetkinin tagını ve chat renklerini çek
			outputChatBox(tag..isim..chat..text, root, r, g, b, true ) -- chate aktar
		elseif playerTag then -- eğer player panelden tag almışsa
			outputChatBox(playerTag.." "..isim.."#FFFFFF:#ededed "..text, root, r, g, b, true ) -- chate aktar
		else --eğer yukardakilerden ikiside yoksa
			outputChatBox(""..isim.."#FFFFFF:#FFFFFF "..text, root, r, g, b, true ) -- chate yolla
		end
	end	

	outputServerLog( "CHAT: "  .. isim:gsub('#%x%x%x%x%x%x', '').. ": " .. text )	
	--exports.ChatBubbles:outputMessage(source, text)
end) 

-- Useful Functions and other events

function playerYetkilimi(player) --player authority function
	if isElement(player)  then	
		local hesapismi = getAccountName(getPlayerAccount(player))
		for i,yetkiler in pairs(yetkiliTaglar) do
			local acl,tag,chat = unpack(yetkiler)
			if aclGetGroup(acl) and isObjectInACLGroup("user." .. hesapismi, aclGetGroup(acl)) then
				return tag,chat
			end	
		end	
	end
	return false
end

function playerTagDraw(player) -- player tag draw function
	if tags[player] then
		return tags[player]
	else
		return false
	end
end	

function isAdvertisement(str) -- export function (if the ad is)
	assert(type(str) == "string", "Bad argument 1 @ isAdvertisement [String expected, got " .. type(str) .. "]")
    local str = string.gsub(str, '#%x%x%x%x%x%x', '')
	local workingWord   = string.lower(str):gsub("[_-;:µ|><!^#'%%!§$\\&/()=._-,-#+}{ ]", '').."-";
        for index, sBadWord in pairs(ayarlar.yasakliKelimeler) do
            local pattern       = workingWord:match(".*"..string.lower(sBadWord).."*.");
            if(pattern) then    
                return sBadWord
            end
        end

	if str:find("(%d+)%.(%d+)%.(%d+)%.(%d+)") then
		return true
	end
	
	return false
end

function isPlayerExcluded(player) -- If the player is authorized
	local size = #ayarlar.excludedGroups
	if size ~= 0 then
		local accountName = getAccountName(getPlayerAccount(player))
		for i=1, size do
			if isObjectInACLGroup("user." .. accountName, aclGetGroup(ayarlar.excludedGroups[i])) then
				return true
			end
		end
	end
	return false
end

addEventHandler("onPlayerConnect", root, function(playerNick, _, _, playerSerial, _)  -- player can not run for 10 seconds at server entrance
	serials[playerSerial] = true 
	setTimer(function() 
		serials[playerSerial] = nil
	end, 1000*10,1)
end)

function giveDue(player) -- Forbidden word Give 3 due
	if not due[player] then
		due[player] = 1
		outputChatBox("#FFFFFFyou wrote a forbidden word. #FFFFFFYou have #CC00002 rights .", player, 255,0,0, true)
		return true
	else
		due[player] = due[player]+1
		if due[player] and due[player]  > 2 then
			due[player] = nil
			return false
		end
		outputChatBox("#FFFFFFyou wrote a forbidden word.. #CC0000"..tostring(due[player]-1).." #FFFFFFHave rights.", player, 255,0,0, true)
		return true
	end
end

function spamBlock(player,value) -- Spam Blocking Function
	local serial = getPlayerSerial(player)
	if value == "Mutele" then
		outputChatBox(getPlayerName(player).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
		setPlayerMuted(player, true)
		setTimer (spamBlock, 60000, 1, player, "Mute Kaldır")
		muteliler[serial] = true
	elseif value == "Mute Kaldır" then	
		if  isElement (player) and isPlayerMuted (player)  then
			setPlayerMuted ( player, false )
			antiSpam[player] = nil
			muteliler[serial] = false
			outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
		else
			antiSpam[player] = nil
		end
	end	
end

addEventHandler("onPlayerJoin", root, function() -- while suspended reconnect punished
	local serial = getPlayerSerial(source)
	if muteliler[serial] then
		spamBlock(source,"Mutele")	
	end
end)

addEventHandler("onPlayerQuit", root, function()
	if tags[source] then tags[source] = nil end
end)

addEvent("TagPanel:TagAyarla", true)
addEventHandler("TagPanel:TagAyarla", root, function(chat,olay)
	if olay == "Değiştir" then
		tags[source] = chat
		outputChatBox("#FFFFFFTagın "..chat.." #FFFFFFolarak değiştirildi", source, 255,0,0, true)
	elseif olay == "Sıfırla" then
		tags[source] = nil
		outputChatBox("#FFFFFFTagını başarıyla sıfırladın.", source, 255,0,0, true)
	end	
end)

80% english look again pls 

Share this post


Link to post
10 hours ago, Yurigarga said:

local tags = {}local fastWrite = {}local someMessage = {} local antiSpam = {}local serials = {}local muteliler = {}local due = {}local ayarlar = { -- meta.xml den çekilen ayarlar	excludedGroups = get"ExcludedGroups" or {},	mesajGorme = get"MesajGorme" or "true",	spamKoruma = get"SpamKoruma" or "true",	kisaltmaMesaj = get"KisaltmaMesaj" or "true",	reklamKoruma = get"ReklamKoruma" or "true",	yasakliKelimeler = get"blacklistedStrings" or {},}addEventHandler('onPlayerChat', root ,function(text,typechat) -- chat eventi	cancelEvent()	local isim = getPlayerName(source)	local r, g, b = getPlayerNametagColor(source) or math.random(0,255), math.random(0,255), math.random(0,255)	local playerTag = playerTagDraw(source)	local randomID = math.random ( 1, #articles )	local article = articles[randomID]	local serial = getPlayerSerial(source)	if serials[serial]  then return end	-- spam protection	if ayarlar.spamKoruma then		if not isPlayerExcluded(source) then			if isTimer(antiSpam[source]) then				cancelEvent()  				spamBlock(source,"Mutele")			else				antiSpam[source] = setTimer(function(player) 					antiSpam[player] = nil 				end, 1000, 1, source) 			end		end		end			-- advertisement protection	if ayarlar.reklamKoruma then		if isAdvertisement(text) then			if not isPlayerExcluded(source) then				for i, yetkililer in ipairs (getElementsByType("player")) do					if isPlayerExcluded(yetkililer) then						if text == article then return end						if ayarlar.mesajGorme then							outputChatBox("#000000[#FF0000WARNİNG#000000] " .. isim ..  " #FF0000the player made an ad: #FFFFFF" .. text, yetkililer, 255, 255, 255, true)							outputServerLog("[ReklamUyari] " .. isim:gsub('#%x%x%x%x%x%x', '') .. ": " .. text)						end					end					end				if giveChance(source) then					text =  article				else					text =  article					spamBlock(source,"Mutele")				end				end			end	end			-- fast write protection    if fastWrite[source] and fastWrite[source]  > getTickCount() then			outputChatBox("write one by one!", source, 255, 0, 0)        return    else        fastWrite[source] = getTickCount()    end		-- someMessage protection    if someMessage[source] and someMessage[source] == text then		outputChatBox("do not write the same words!!", source, 255, 0, 0)		return    else        someMessage[source] = text    end			-- abbreviation message	if ayarlar.kisaltmaMesaj then		for i,v in pairs ( mesajTablo ) do			for k,t in pairs(i) do				if text:lower() == t then					text = v				end			end			end	end			if typechat == 2 then cancelEvent() end -- eğer Y den yazmışsa iptal et		if typechat == 0 then -- eğer T den yazmış ise		if playerYetkilimi(source) then -- eğer player yetkili ise			local tag,chat = playerYetkilimi(source) -- yetkinin tagını ve chat renklerini çek			outputChatBox(tag..isim..chat..text, root, r, g, b, true ) -- chate aktar		elseif playerTag then -- eğer player panelden tag almışsa			outputChatBox(playerTag.." "..isim.."#FFFFFF:#ededed "..text, root, r, g, b, true ) -- chate aktar		else --eğer yukardakilerden ikiside yoksa			outputChatBox(""..isim.."#FFFFFF:#FFFFFF "..text, root, r, g, b, true ) -- chate yolla		end	end		outputServerLog( "CHAT: "  .. isim:gsub('#%x%x%x%x%x%x', '').. ": " .. text )		--exports.ChatBubbles:outputMessage(source, text)end) -- Useful Functions and other eventsfunction playerYetkilimi(player) --player authority function	if isElement(player)  then			local hesapismi = getAccountName(getPlayerAccount(player))		for i,yetkiler in pairs(yetkiliTaglar) do			local acl,tag,chat = unpack(yetkiler)			if aclGetGroup(acl) and isObjectInACLGroup("user." .. hesapismi, aclGetGroup(acl)) then				return tag,chat			end			end		end	return falseendfunction playerTagDraw(player) -- player tag draw function	if tags[player] then		return tags[player]	else		return false	endend	function isAdvertisement(str) -- export function (if the ad is)	assert(type(str) == "string", "Bad argument 1 @ isAdvertisement [String expected, got " .. type(str) .. "]")    local str = string.gsub(str, '#%x%x%x%x%x%x', '')	local workingWord   = string.lower(str):gsub("[_-;:µ|><!^#'%%!§$\\&/()=._-,-#+}{ ]", '').."-";        for index, sBadWord in pairs(ayarlar.yasakliKelimeler) do            local pattern       = workingWord:match(".*"..string.lower(sBadWord).."*.");            if(pattern) then                    return sBadWord            end        end	if str:find("(%d+)%.(%d+)%.(%d+)%.(%d+)") then		return true	end		return falseendfunction isPlayerExcluded(player) -- If the player is authorized	local size = #ayarlar.excludedGroups	if size ~= 0 then		local accountName = getAccountName(getPlayerAccount(player))		for i=1, size do			if isObjectInACLGroup("user." .. accountName, aclGetGroup(ayarlar.excludedGroups[i])) then				return true			end		end	end	return falseendaddEventHandler("onPlayerConnect", root, function(playerNick, _, _, playerSerial, _)  -- player can not run for 10 seconds at server entrance	serials[playerSerial] = true 	setTimer(function() 		serials[playerSerial] = nil	end, 1000*10,1)end)function giveDue(player) -- Forbidden word Give 3 due	if not due[player] then		due[player] = 1		outputChatBox("#FFFFFFyou wrote a forbidden word. #FFFFFFYou have #CC00002 rights .", player, 255,0,0, true)		return true	else		due[player] = due[player]+1		if due[player] and due[player]  > 2 then			due[player] = nil			return false		end		outputChatBox("#FFFFFFyou wrote a forbidden word.. #CC0000"..tostring(due[player]-1).." #FFFFFFHave rights.", player, 255,0,0, true)		return true	endendfunction spamBlock(player,value) -- Spam Blocking Function	local serial = getPlayerSerial(player)	if value == "Mutele" then		outputChatBox(getPlayerName(player).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 		setPlayerMuted(player, true)		setTimer (spamBlock, 60000, 1, player, "Mute Kaldır")		muteliler[serial] = true	elseif value == "Mute Kaldır" then			if  isElement (player) and isPlayerMuted (player)  then			setPlayerMuted ( player, false )			antiSpam[player] = nil			muteliler[serial] = false			outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )		else			antiSpam[player] = nil		end	end	endaddEventHandler("onPlayerJoin", root, function() -- while suspended reconnect punished	local serial = getPlayerSerial(source)	if muteliler[serial] then		spamBlock(source,"Mutele")		endend)addEventHandler("onPlayerQuit", root, function()	if tags[source] then tags[source] = nil endend)addEvent("TagPanel:TagAyarla", true)addEventHandler("TagPanel:TagAyarla", root, function(chat,olay)	if olay == "Değiştir" then		tags[source] = chat		outputChatBox("#FFFFFFTagın "..chat.." #FFFFFFolarak değiştirildi", source, 255,0,0, true)	elseif olay == "Sıfırla" then		tags[source] = nil		outputChatBox("#FFFFFFTagını başarıyla sıfırladın.", source, 255,0,0, true)	end	end)

80% english look again pls 

Yet I still don't know what you want to do with this script, please explain your goal and then I can see where you are going wrong.

  • Sad 1

Share this post


Link to post
function spamEngelle(oyuncu,deger) -- spam engelleme fonksiyon
 if isElement (oyuncu) then -- player check
      local serial = getPlayerSerial(oyuncu)
      if deger == "Mutele" then
          outputChatBox(getPlayerName(oyuncu).."#CC0000 60 #FFFFFFSaniye Susturuldun. #CC0000Sebep: #FFFFFFFlood/Spam", root, 255,255,255,true) 
          setPlayerMuted(oyuncu, true)
          setTimer (spamEngelle, 60000, 1, oyuncu, "Mute Kaldır")
          muteliler[serial] = true
      elseif deger == "Mute Kaldır" then	
          if  isElement (oyuncu) and isPlayerMuted (oyuncu)  then
              setPlayerMuted ( oyuncu, false )
              antiSpam[oyuncu] = nil
              muteliler[serial] = false
              outputChatBox ("#FFFFFF"..getPlayerName ( oyuncu ).." #66FF00Cezan Bitti.",root, 255, 255, 0,true )
          else
              antiSpam[oyuncu] = nil
          end
      end	
  end
end

try this

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.