Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-04-13, 13:34


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Witam przychodz? z pytaniem jakich funkcji u?y? by zabezpieczy? serwer przed reklamami chodzi o to, ?e jak kto? wy?le ip innego serwera dostaje kicka tak samo z linkami do discorda

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 13:42


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

https://community.mtasa.com/index.php?p=resources&s=details&id=13376

Je?li nie chcesz pobiera?, tutaj gotowa funkcja do sprawdzania tego:

local BannedWords = {"22003"":22""22010""22005""tasa:"}

    function checkBannedWords(Message)

      for _BannedWord in ipairs(BannedWords) do
        if (Message:lower()):find(BannedWord:lower()) then
          return 2
        end
      end

      local Chunks = {(Message:gsub("%s+""")):match("(%d+)%.(%d+)%.(%d+)%.(%d+)")}
      if (#Chunks == 4) then
        return 1
      end

      return 0
    end


Sprawdzasz czy to, co zwr?ci funkcja 'checkBannedWords' jest r?wne 2 lub 1. Wtedy wiesz, ?e gracz pr?buje wklei? IP. Tak samo robisz z discordem, dodajesz do tabelki has?o szczeg?lne, kt?re wyst?puj w linku zaproszenia.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 13:57


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

"Wilq" napisał/a:

https://community.mtasa.com/index.php?p=resources&s=details&id=13376

Je?li nie chcesz pobiera?, tutaj gotowa funkcja do sprawdzania tego:

local BannedWords = {"22003"":22""22010""22005""tasa:"}

    function checkBannedWords(Message)

      for _BannedWord in ipairs(BannedWords) do
        if (Message:lower()):find(BannedWord:lower()) then
          return 2
        end
      end

      local Chunks = {(Message:gsub("%s+""")):match("(%d+)%.(%d+)%.(%d+)%.(%d+)")}
      if (#Chunks == 4) then
        return 1
      end

      return 0
    end


Sprawdzasz czy to, co zwr?ci funkcja 'checkBannedWords' jest r?wne 2 lub 1. Wtedy wiesz, ?e gracz pr?buje wklei? IP. Tak samo robisz z discordem, dodajesz do tabelki has?o szczeg?lne, kt?re wyst?puj w linku zaproszenia.


dzi?ki tylko jeszcze jedno pytanie jak do tego doda? by na prywatne wiadomo?? te? to dzia?a?o

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 14:03


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

W funkcji podpi?tej do komendy odpowiedzialnej za prywatne wiadomo?ci wykonaj r?wnie? sprawdzanie za pomoc? tej funkcji (checkBannedWords). Je?li masz domy?lny prywatny czat (/msg), u?yj eventu:

Więcej informacji znajdziesz w Wikipedii MTA:

onPlayerChat


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 14:06


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

"Wilq" napisał/a:

W funkcji podpi?tej do komendy odpowiedzialnej za prywatne wiadomo?ci wykonaj r?wnie? sprawdzanie za pomoc? tej funkcji (checkBannedWords). Je?li masz domy?lny prywatny czat (/msg), u?yj eventu:

Więcej informacji znajdziesz w Wikipedii MTA:

onPlayerChat

?le napisa?em nie chodzi mi o msg tylko mam pw

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 14:08


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Cytat:

W funkcji podpi?tej do komendy odpowiedzialnej za prywatne wiadomo?ci wykonaj r?wnie? sprawdzanie za pomoc? tej funkcji (checkBannedWords).


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 14:39


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22


function onPrivateMessage(plrcmdtarget, ...)
    if not (getElementData(plr"player:logged") == truethen return end
    if getElementData(plr,'player:mute'then outputChatBox('Posiadasz kar? wyciszenia! Uwa?asz ?e kara jest nies?uszna? Zaapeluj na discordzie.',plr) return end
    if not target or not {...} then
        outputChatBox('Poprawne u?ycie: #FFFF00/pm <nick/ID> <tre??>'plr255,255,255,true)
        return
    end
    if getElementData(plr"mute:player"then
        outputChatBox("* Jeste? wyciszony!"plr)
        return
    end
    if getElementData(plr"antyspam:pw") == 2 then return end
    setElementData(plr"antyspam:pw"2)
    setTimer(function()
    setElementData(plr"antyspam:pw"false)
    end30001)
    if checkBannedWords(msgthen return end
    local text=table.concat({...}, ' ')
    local target=findPlayer(plrtarget)
    if not target then
        outputChatBox("Nie znaleziono podanego gracza."plr255,0,0,true)
        return
    end
    if not (getElementData(target"player:logged") == truethen
        outputChatBox("Podany gracz nie jest zalogowany."plr255,0,0,true)
    return end

    local pmoff=getElementData(target,"pmoff")
    if (pmoffthen
        outputChatBox("Gracz: "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." posiada w??czony tryb ignorowania wiadomo?ci prywatnych."plr255,0,0,true)
        if (type(pmoff)=="string"then
            outputChatBox("Pow?d ignorowania: " .. pmoffplr255,0,0,true)
        end
    return
    end

    if getElementData(plr,"pmoff"then
      outputChatBox("Posiadasz w??czony tryb ignorowania wiadomo?ci prywatnych. Osoba do kt?rej napisa?e?/a? nie b?dzie mog?a Ci odpisa?."plr0,255,0true)
    end
    
    if getElementData(target"mute:player"then
        outputChatBox("Ten gracz jest wyciszony, nie odpisze Ci!"plr255,0,0)
        return
    end
    outputChatBox("#FFFFFF[#FFFF00Wys?ane] #FFFFFF(#FFFF00"..getElementData(target,"id").."#FFFFFF) #FFFF00"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."#FFFFFF: "..text..""plr2452190true)
    outputChatBox("#FFFFFF[#FFFF00Odebrane] #FFFFFF(#FFFF00"..getElementData(plr,"id").."#FFFFFF) #FFFF00"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#FFFFFF: "..text..""target2251990true)
    playSoundFrontEnd(target12)
      local pm_text=('[PM] [%d]%s(sid:%d) >> [%d]%s(sid:%d): %s'):format(getElementData(plr,"id"), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:sid"), getElementData(target,"id"), getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getElementData(target,"player:sid"), text)
    triggerEvent("admin:addText"resourceRootRGBToHex(255,0,0)..pm_text..RGBToHex(255,255,255),math.random(0,99))
    triggerEvent("admin:logs"rootpm_text)
    --triggerClientEvent(root"onDebugMessage"resourceRootpm_text:gsub("#%x%x%x%x%x%x",""),1"PM")
    outputServerLog(pm_text)
    exports["np-discord"]:connectWeb(('[PM] [%d]%s(sid:%d) >> [%d]%s(sid:%d): %s'):format(getElementData(plr,"id"), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"player:sid"), getElementData(target,"id"), getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getElementData(target,"player:sid"), text), "logipw")
end
addCommandHandler('pw'onPrivateMessage)


local BannedWords = {"22003"":22""22010""22005""tasa:""discord.gg"}

addEventHandler("onPlayerChat",root,
  function(msg)

    function checkBannedWords(Message)

      for _BannedWord in ipairs(BannedWords) do
        if (Message:lower()):find(BannedWord:lower()) then
          return 2
        end
      end

      local Chunks = {(Message:gsub("%s+""")):match("(%d+)%.(%d+)%.(%d+)%.(%d+)")}
      if (#Chunks == 4) then
        return 1
      end

      return 0
    end


    -- Definitions
    -- Might be an advert
    -- Confirmed advert

    local result checkBannedWords(msg)
    if (result == 1then
      cancelEvent()
      outputChatBox("Your Message was detected as potential server advert and you're in trouble now if true."source25500)
      outputServerLog("[SUSPECT-ADVERTISING] " .. getPlayerName(source) .. " (tried to) output '" .. msg .. "'")
      local _players getElementsByType("player")
      for _v in pairs(_players) do
        if (getPlayerAccount(v)) then
          if ((isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")))) then
            outputChatBox("[SUSPECT-ADVERTISING] " .. getPlayerName(source) .. " (tried to) output '" .. msg .. "'"v)
          end
        end
      end
    elseif (result == 2then
      cancelEvent()
      local g_Name getPlayerName(source)
      local _r,_g,_b getPlayerNametagColor(source)
      outputChatBoxg_Name .. ":server-advertiser " .. ' was detected and temporarily banned' g_Root_r_g_bfalse)
      --banPlayer sourcefalsefalsetruenil"Don't advertise other servers, you got an 1-day ban for it now."86400 )
    end
  end
)


attempt to call global 'checkBannedWords' (a nil value)

i nie wiem jak to naprawi?

 if checkBannedWords(msgthen return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-13, 15:01


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Musisz funkcje zdefiniowa? globalnie, je?li to ten sam skrypt - usu? local przed funkcj?.

Postaw piwo autorowi tego posta
 

 
Tagi: zabezpieczenie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » zabezpieczenie Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku