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: 2837 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:
--[[
    ResourceOURGame
    DevelopersSplit <split.programista@gmail.com>
    Copyright <split.programista@gmail.com2015-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(plrthen
return getplayernamex(plr):gsub("#%x%x%x%x%x%x","")
end
end--]]

--[[function getPlayerName2(plr)
if not plr then return end
if isElement(plrthen
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[playerthen 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(msgtype)
    cancelEvent()
    if not getElementData(source,"player:uid"then
    outputChatBox("* Musisz by? zalogowany(a) !"source)
    return end
    local tick=getTickCount()
    --if sprawdzmute(source,msgthen cancelEvent() return end
    if type==0 then
        cancelEvent()
        if ninjaban(msg) and not getAdmin(source3then
        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(sourcethen return end
        local x,y,z=getElementPosition(source)
        local sphere=createColSphere(x,y,z30)
        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,1then
            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"resourceRootdesc:gsub("#%x%x%x%x%x%x",""),1"CZAT")
        triggerEvent("admin:addText"resourceRootdesc: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(source3then
        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,z30)
        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",""), v255128255)
        end
        local q string.format("Chat /me> "..getPlayerName(source).."("..getElementData(source,"id").."): "..msg:gsub("#%x%x%x%x%x%x",""))
        triggerEvent("admin:addText"resourceRootq:gsub("#%x%x%x%x%x%x",""))
        triggerClientEvent("onDebugMessage"resourceRootq,1"/ME")
    end
end)

--addCommandHandler('do', function(sourcecmd,...)
--[[addCommandHandler('ooc', function(sourcecmd, ...)
    local username=getElementData(source,"player:logged")
    if (not usernamethen
    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,1then
        outputChatBox("* Czat OOC zosta? wy??czony przez Administratora."source255,0,0,true)
        return
    end

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

addCommandHandler('do', function(sourcecmd, ...)
    local text=table.concat({...}, ' ')
    if not text then return end
        if ninjaban(text) and not getAdmin(source3then
        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,msgthen return cancelEvent() end
    local x,y,z=getElementPosition(source)
    local sphere=createColSphere(x,y,z30)
    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","").." )) **"v0160255)
    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(plrcmd)
    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) < or tonumber(v) > 255then
                return false
            else
            return true
            end
        end
    else
        return false
    end

    return false
end

function findBadWords(playermsg)
    local count 0
    for i,v in ipairs(bad_words) do
        if string.find(msg:lower(), vthen
            local c ""
            for i=1,v:len() do
                c.."*"
            end
            local k1,k2 string.find(msg:lower(), v)
            --msg string.gsub(msg:lower(), vc)
            msg string.gsub(msgstring.sub(msgk1k2), c)
            count count 1
        end
    end
    if count 0 then
        outputChatBox("* Wyra?enia wulgarne s? na tym serwerze zabronione"player25500)
    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 iv in ipairs getElementsByType "player" ) ) do
            wyczysc )
        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: 3988 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

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: 2837 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: 3805 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: 2837 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: 3988 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

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