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

Wysłany: 2016-05-05, 23:02


FaydenFX.







Wiek: 27
Na forum: 4057 dni
Posty: 246
Nick w MP: faydn

Piwa: 11

Respekt: 45,3

Witam, pom?g? by kto? zmieni? logi serwerowe i raporty tak, ?eby nie by?y na MySQL , tylko ACL? ;x




local xtext=nil
local gameView={"Logi serwerowe"}
local reportView={"Lista raport?w"}
local sx,sy=guiGetScreenSize()

addEventHandler("onClientRender"root, function()
    local accName getAccountName getPlayerAccount thePlayer ) )
    if isObjectInACLGroup ("user."..accNameaclGetGroup "RCON" ) ) then
    concat=table.concat(gameView"\n")
    dxDrawText(concatsx*(10+1)/1024sy*(279+1)/768sx*(326+1)/1024sy*(497+1)/768tocolor(000255), 1.00"default""left""top"falsetrue)
    dxDrawText(concatsx*(10)/1024sy*(279)/768sx*(326)/1024sy*(497)/768white1.00"default""left""top"falsetrue)
end)

function renderingInfo()
dxDrawRectangle(sx*(258)/1024sy*(0)/768sx*(500)/1024sy*(23)/768tocolor(000155), false)
    dxDrawText(xtextsx*(258+1)/1024sy*(0+1)/768sx*(758+1)/1024sy*(23+1)/768tocolor(000255), 1.00"default""center""center"falsetrue)
    dxDrawText(xtextsx*(258)/1024sy*(0)/768sx*(758)/1024sy*(23)/768tocolor(25500255), 1.00"default""center""center"falsetrue)
end

addEventHandler("onClientRender"root, function()
    local accName getAccountName getPlayerAccount thePlayer ) )
    if isObjectInACLGroup ("user."..accNameaclGetGroup "RCON" ) ) then
    local tt={}
    for i,v in ipairs(reportView) do
        if v[1then table.insert(tt,v[1]) end
    end
    concat=table.concat(tt"\n")
    dxDrawText(concatsx*(698+1)/1024sy*(278+1)/768sx*(1014+1)/1024sy*(496+1)/768tocolor(000255), 1.00"default""right""top"falsetrue)
    dxDrawText(concatsx*(698)/1024sy*(278)/768sx*(1014)/1024sy*(496)/768tocolor(255255255255), 1.00"default""right""top"falsetrue)
end)

addEvent("admin:addText"true)
addEventHandler("admin:addText"root, function(text)
    table.insert(gameViewtext)    
    if #gameView > 10 then
        table.remove(gameView1)
    end
end)

addEvent("admin:addReport"true)
addEventHandler("admin:addReport"root, function(text,id)
    table.insert(reportView, {text,id})
    if #reportView > 10 then
        table.remove(reportView1)
    end
end)

addEvent("admin:removeReport"true)
addEventHandler("admin:removeReport"root, function(id)
    for i=#reportView, 1, -1 do
        if reportView[i][2] == id then
            table.remove(reportView,i)
        end
    end
end)

addEvent("admin:rendering"true)
addEventHandler("admin:rendering"root, function(text)
    xtext=text
    addEventHandler("onClientRender"rootrenderingInfo)
    setTimer(function()
        removeEventHandler("onClientRender"rootrenderingInfo)
    end50001)
end)


Zrobi?em tak, lecz nic nie wy?wietla.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 01:07


Prezes.







Wiek: 27
Na forum: 4371 dni
Posty: 75
Nick w MP: Prezes.

Piwa: 17

Respekt: 60

Najlepiej b?dzie Ci zrobi? tak:

S-side;

function onAdminLogin()
local accName getAccountName(getPlayerAccount(source))
    if accName and isObjectInACLGroup ("user."..accNameaclGetGroup("RCON")) then
    setElementData(source,"auth:admin",true)
    end
end
addEventHandler("onPlayerLogin",root,onAdminLogin)


c-side:

local xtext=nil
local gameView={"Logi serwerowe"}
local reportView={"Lista raport?w"}
local sx,sy=guiGetScreenSize()

addEventHandler("onClientRender"root, function()
    if getElementData(localPlayer,"auth:admin"then
    concat=table.concat(gameView"\n")
    dxDrawText(concatsx*(10+1)/1024sy*(279+1)/768sx*(326+1)/1024sy*(497+1)/768tocolor(000255), 1.00"default""left""top"falsetrue)
    dxDrawText(concatsx*(10)/1024sy*(279)/768sx*(326)/1024sy*(497)/768white1.00"default""left""top"falsetrue)
end
end)

function renderingInfo()
dxDrawRectangle(sx*(258)/1024sy*(0)/768sx*(500)/1024sy*(23)/768tocolor(000155), false)
    dxDrawText(xtextsx*(258+1)/1024sy*(0+1)/768sx*(758+1)/1024sy*(23+1)/768tocolor(000255), 1.00"default""center""center"falsetrue)
    dxDrawText(xtextsx*(258)/1024sy*(0)/768sx*(758)/1024sy*(23)/768tocolor(25500255), 1.00"default""center""center"falsetrue)
end

addEventHandler("onClientRender"root, function()
   if getElementData(localPlayer,"auth:admin"then
    local tt={}
    for i,v in ipairs(reportView) do
        if v[1then table.insert(tt,v[1]) end
    end
    concat=table.concat(tt"\n")
    dxDrawText(concatsx*(698+1)/1024sy*(278+1)/768sx*(1014+1)/1024sy*(496+1)/768tocolor(000255), 1.00"default""right""top"falsetrue)
    dxDrawText(concatsx*(698)/1024sy*(278)/768sx*(1014)/1024sy*(496)/768tocolor(255255255255), 1.00"default""right""top"falsetrue)
end
end)

addEvent("admin:addText"true)
addEventHandler("admin:addText"root, function(text)
    table.insert(gameViewtext)    
    if #gameView > 10 then
        table.remove(gameView1)
    end
end)

addEvent("admin:addReport"true)
addEventHandler("admin:addReport"root, function(text,id)
    table.insert(reportView, {text,id})
    if #reportView > 10 then
        table.remove(reportView1)
    end
end)

addEvent("admin:removeReport"true)
addEventHandler("admin:removeReport"root, function(id)
    for i=#reportView, 1, -1 do
        if reportView[i][2] == id then
            table.remove(reportView,i)
        end
    end
end)

addEvent("admin:rendering"true)
addEventHandler("admin:rendering"root, function(text)
    xtext=text
    addEventHandler("onClientRender"rootrenderingInfo)
    setTimer(function()
        removeEventHandler("onClientRender"rootrenderingInfo)
    end50001)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 13:03


FaydenFX.







Wiek: 27
Na forum: 4057 dni
Posty: 246
Nick w MP: faydn

Piwa: 11

Respekt: 45,3

debug w
        if reportView[i:1][2] == id then
name expected near '1'

[ Dodano: 2016-05-06, 14:13 ]
Kto? co??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 18:41


Prezes.







Wiek: 27
Na forum: 4371 dni
Posty: 75
Nick w MP: Prezes.

Piwa: 17

Respekt: 60

Sprawd? tak.


addEvent("admin:removeReport"true)
addEventHandler("admin:removeReport"root, function(id)
    for i=#reportView, 1, -1 do
        if (reportView[i][2] and reportView[i][2] == idthen -- Znaczniki ?le pokazujpowinno bysamo i w nawiasach kwadratowych
            table.remove(reportView,i)
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 19:35


FaydenFX.







Wiek: 27
Na forum: 4057 dni
Posty: 246
Nick w MP: faydn

Piwa: 11

Respekt: 45,3

ten sam zn?w debug w
 if (reportView[i:1][2] and reportView[i:2][2] == idthen


;v

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 20:50


Prezes.







Wiek: 27
Na forum: 4371 dni
Posty: 75
Nick w MP: Prezes.

Piwa: 17

Respekt: 60

Tag lua ?le pokazuje, sprawd? czy masz wpisane

if (reportView[i][2] and reportView[i][2] == id) then

Postaw piwo autorowi tego posta
 

 
Tagi: logi :: serwerowe :: itp.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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