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

Wysłany: 2018-08-31, 18:32


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

Gdy pr?buj? co? napisa? na chacie. To nic nie wyskakuje, a jak zabior? se premium to ju? mog? pisa?. Problem chyba jest w ogrpg-core/chats.lua.

Kod chats.lua:
--[[
    Resource: OURGame
    Developers: Split <split.programista@gmail.com>
    Copyright <split.programista@gmail.com> 2015-2016
    You have no right to use this code without my permission.
]]
function getPremium(plr,premium)
    if premium then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=? AND premium=?",getElementData(plr,"player:uid"), premium)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", getElementData(plr,"player:uid"))
        if result and #result > 0 then
            return true
        else
            return false
        end
    end
end

function getPremium(plr,premium)
    if premium then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=? AND premium=?",getElementData(plr,"player:uid"), premium)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", getElementData(plr,"player:uid"))
        if result and #result > 0 then
            return true
        else
            return false
        end
    end
end

wiadomosci= {}
words = {"22003",":220","78.157","23.235","22015","22010","22020","22017","mtasa://"}


local getplayernamex = getPlayerName

--[[local function getPlayerName(plr)
if not plr then return end
if isElement(plr) then
return getplayernamex(plr):gsub("#%x%x%x%x%x%x","")
end
end--]]

--[[function getPlayerName2(plr)
if not plr then return end
if isElement(plr) then
return getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
end
end--]]

local function wtf(player)
if not player then return end
if isElement ( player ) then
    if not wiadomosci[player] then return end
    wiadomosci[player].text = nil; 
    wiadomosci[player].warnings = 0 
end 
end

local bad_words = {"k****", "c***", "*****", "*****", "****", "*****", "*****?", "j***e", "*****?em", "*****?am", "jeb?em", "jeb?am", "******", "k****", "k****", "k***", "kurewsko", "k***", "k***", "k***", "*****", "p****", "p****", "k***", "k***", "k***", "k***", "k***?", "k***", "napierdala", "s********j", "spierdalam", "spierdalamy", "spierdalajcie", "sprierdalaj?", "k****"}

addEventHandler('onPlayerChat', root, function(msg, type)
    cancelEvent()
    if not getElementData(source,"player:uid") then
    outputChatBox("* Musisz by? zalogowany(a) !", source)
    return end
    local tick=getTickCount()
    --if sprawdzmute(source,msg) then cancelEvent() return end
    if type==0 then
        cancelEvent()
        if ninjaban(msg) and not getAdmin(source, 3) then
        triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(source).."("..getElementData(source,"id")..") zosta?(a) wyrzucony(a) przez system. Powod: Reklama")
        kickPlayer (source, "System:Reklama")
        return end
        if not isElement(source) then return end
        local x,y,z=getElementPosition(source)
        local sphere=createColSphere(x,y,z, 30)
        local players=getElementsWithinColShape(sphere, 'player')
        if getElementData(source, "mute:player") then
            outputChatBox("* Masz Zablokowan? Mo?liwo?c pisania! Przez System [ANTY-SPAM]", source)
            return
        end
        for i,v in pairs(players) do
            local id=getElementData(source,"id")
            local level = tonumber(getElementData(source, "player:level"))
            if not level and not getPremium(source,1) then
            outputChatBox("#FFFFFF(#FFFFFF"..getElementData(source,"id").."#FFFFFF) #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v, _, _, _, true)
            elseif level == 1 then
            cancelEvent()
            outputChatBox("#FFFFFF(#01bf34"..getElementData(source,"id").."#FFFFFF) #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v, _, _, _, true)
            elseif level == 2 then
            cancelEvent()
            outputChatBox("#FFFFFF(#ff0000"..getElementData(source,"id").."#FFFFFF) #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v, _, _, _, true)
            elseif level == 3 then
            cancelEvent()
            outputChatBox("#FFFFFF(#a31303"..getElementData(source,"id").."#FFFFFF) #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v, _, _, _, true)
            elseif level == 4 then
            cancelEvent()
            outputChatBox("#FFFFFF(#a31303"..getElementData(source,"id").."#FFFFFF) #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v, _, _, _, true)
            elseif p_level == 1 then
            cancelEvent()
            outputChatBox("#FFFFFF(#C0FF00"..getElementData(source,"id").."#FFFFFF) #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..":#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v, _, _, _, true)
        end
        end
        destroyElement(sphere)
        
        local desc = string.format("Czat Lokalny> %s(%d):%s",getPlayerName(source),getElementData(source,"id"),msg:gsub("#%x%x%x%x%x%x",""))
        triggerClientEvent(root, "onDebugMessage", resourceRoot, desc:gsub("#%x%x%x%x%x%x",""),1, "CZAT")
        triggerEvent("admin:addText", resourceRoot, desc:gsub("#%x%x%x%x%x%x",""))
        outputServerLog('Czat Lokalny> '..getPlayerName(source)..'('..getElementData(source,"id")..'): '..msg)
        triggerClientEvent("onChatbubblesMessageIncome",source,msg:gsub("#%x%x%x%x%x%x",""),0)
    elseif type==1 then
        cancelEvent()
        if ninjaban(msg) and not getAdmin(source, 3) then
        kickPlayer (source, "System:Reklama")
        triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."("..getElementData(source,"id")..") zosta?(a) wyrzucony(a) przez system. Powod: Reklama")
        return end
        local x,y,z=getElementPosition(source)
        local sphere=createColSphere(x,y,z, 30)
        local players=getElementsWithinColShape(sphere, 'player')
        destroyElement(sphere)
        for i,v in pairs(players) do
            outputChatBox("** "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." "..msg:gsub("#%x%x%x%x%x%x",""), v, 255, 128, 255)
        end
        local q = string.format("Chat /me> "..getPlayerName(source).."("..getElementData(source,"id").."): "..msg:gsub("#%x%x%x%x%x%x",""))
        triggerEvent("admin:addText", resourceRoot, q:gsub("#%x%x%x%x%x%x",""))
        triggerClientEvent("onDebugMessage", resourceRoot, q,1, "/ME")
    end
end)

--addCommandHandler('do', function(source, cmd,...)
--[[addCommandHandler('ooc', function(source, cmd, ...)
    local username=getElementData(source,"player:logged")
    if (not username) then
    outputChatBox("* Musisz by? zalogowany(a) aby korzysta? z czatu OOC",source,255,0,0,true)
    return
    end

    if (not ooc_enabled and not getAdmin(source,3) and not getAdmin(source,2) and not getAdmin(source,1) then
        outputChatBox("* Czat OOC zosta? wy??czony przez Administratora.", source, 255,0,0,true)
        return
    end

    local message=table.concat( arg, " " )
        outputChatBox( "OOC> #909090["..getElementData(source,"id").."] "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."#FFFFFF: #FFFFFF" .. stripColors(message), getRootElement(), 255,255,0, true)
    end
end)
--addCommandHandler("ooc",cmd_chatOOC,false,false)--]]

addCommandHandler('do', function(source, cmd, ...)
    local text=table.concat({...}, ' ')
    if not text then return end
        if ninjaban(text) and not getAdmin(source, 3) then
        triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(source).."("..getElementData(source,"id")..") zosta?(a) wyrzucony(a) przez system. Powod: Reklama")
        kickPlayer (source, "System:Reklama")
        return end
    local msg=table.concat({...}, " ")
    --if sprawdzmute(source,msg) then return cancelEvent() end
    local x,y,z=getElementPosition(source)
    local sphere=createColSphere(x,y,z, 30)
    local players=getElementsWithinColShape(sphere, 'player')
    destroyElement(sphere)

    for i,v in ipairs(players) do
        outputChatBox("** "..msg.." (( "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." )) **", v, 0, 160, 255)
    end
    triggerClientEvent("onDebugMessage", resourceRoot, "* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."(("..msg.."))",1, "/ME")
    triggerEvent("admin:addText", resourceRoot, "Chat /do>"..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."(("..msg.."))",math.random(0,99))
    outputServerLog('Czat /do> '..getPlayerName(source)..'('..getElementData(source,"id")..'): '..msg):gsub('#%x%x%x%x%x%x','')
end)

addCommandHandler('vmoje', function(plr, cmd)
    local uid=getElementData(plr,'player:uid')
    if not uid then return end
    outputChatBox('* Twoje pojazdy (zrespione na mapie): ', plr)
    outputChatBox('====================================', plr)

    local vehicles=getElementsByType('vehicle')
    for i,v in pairs(vehicles) do
        if getElementData(v,'vehicle:ownedPlayer') and getElementData(v,'vehicle:ownedPlayer')==uid then
            outputChatBox("* Nazwa: "..getVehicleNameFromModel(getElementModel(v))..", ID: "..getElementData(v,"vehicle:id"), plr)
        end
    end
end)


function ninjaban(ip)
    -- must pass in a string value
    if ip == nil or type(ip) ~= "string" then
        return false
    end

    -- check for format 1.11.111.111 for ipv4
    local chunks = {ip:match("(%d+)%.(%d+)%.(%d+)%.(%d+)")}
    if (#chunks == 4) then
        for _,v in pairs(chunks) do
            if (tonumber(v) < 0 or tonumber(v) > 255) then
                return false
            else
            return true
            end
        end
    else
        return false
    end

    return false
end

function findBadWords(player, msg)
    local count = 0
    for i,v in ipairs(bad_words) do
        if string.find(msg:lower(), v) then
            local c = ""
            for i=1,v:len() do
                c = c.."*"
            end
            local k1,k2 = string.find(msg:lower(), v)
            --msg = string.gsub(msg:lower(), v, c)
            msg = string.gsub(msg, string.sub(msg, k1, k2), c)
            count = count + 1
        end
    end
    if count > 0 then
        outputChatBox("* Wyra?enia wulgarne s? na tym serwerze zabronione", player, 255, 0, 0)
    end
    return msg
end


--[[addEventHandler("onResourceStart", root, function() 
local players=getElementsByType('player')
for _, p in pairs(players) do
bindKey(p, "b", "down", "chatbox", "ooc")
end
end)

addEventHandler( "onPlayerSpawn", getRootElement(),
    function (_)
    bindKey(source, "b", "down", "chatbox", "ooc")
    end
)--]]

--[[addEventHandler ( "onResourceStop", resourceRoot,
    function ( )
        for i, v in ipairs ( getElementsByType ( "player" ) ) do
            wyczysc ( v )
        end
    end
)--]]


SS'y:






Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 18:50


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

Db3 co? wskazuje? Dobrze masz element daty?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 19:03


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

ta wszystko jest dobrze. DB3 nic nie wskazuje.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 21:55


SamsungPLL

Programista lodówek






Wiek: 23
Na forum: 3946 dni
Posty: 123
Nick w MP: SamsungPLL

Piwa: 135

Respekt: 55,3

W?tpi? ?e b??d le?y po tej stronie, owszem pe?ni on funkcje wysy?ania wiadomo?ci na chat ale ja u?ywaj?c owego kodu mog? normalnie pisa? na chacie, czy to z premium czy to bez.

Podpis

1000 DNI NA FORUM: 28.09.2018r.
100 POSTÓW NA FORUM: 01.12.2017r.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 23:01


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

spr?buje sam to naprawi?.. dam zna? jak mi si? uda, a jak nie to bd musia? z wami to naprawia? ;P

[ Dodano: 2018-08-31, 23:09 ]
Naprawi?em, przepraszam ?e jestem taki chamski ?e nie daje wam szans ?eby?cie mi pomogli.

Rozwi?za?em problem poprzez wgranie s_chats.lua do ogrpg-core z paczki pys 3.0.

[ Dodano: 2018-08-31, 23:09 ]
Do Zamkni?cia! (@lock)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-31, 23:27


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

Yank3S, Pewnie co? z funkcj? premium, albo db, sorry, ?e nie pomog?em, ale czasu nie mia?em :)

Postaw piwo autorowi tego posta
 

 
Tagi: premium
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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