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

Wysłany: 2017-03-06, 14:37


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

Prosz? o pomoc poniewa? nie mog? usuwac report?w zrobi?em ju? zeby sie wyswietla?y na ekranie lecz nie mog? zrobi? usuwania


function cmd_cl(plr,cmd,id,...)
  if (not id) then
    outputChatBox("U?yj: /cl <id/nick> <powod>", plr)
    return
  end


  local powod=table.concat(arg, " ")
  if (string.len(powod)<2) then
    outputChatBox("U?yj: /cl <id/nick> <powod>", plr)
    return
  end

  local target=exports["czaty"]:findPlayer(plr,id)
  local opis="?"
  if (target) then
    id=getElementData(target,"id")
    opis=getPlayerName(target)
  end

  reportView(tonumber(id))
  local supportLogin=getElementData(plr, "admin:addText")
  msgToSupport(supportLogin .. " usun??/??a raport na " .. opis .. "/".. id .. ": " .. powod)
end
addCommandHandler("cl", cmd_cl, false, false)


db3
Kod:

[2017-03-06 14] ERROR: [Administracja]/admins-pol/reports.lua:49: attempt to call global 'reportView' (a nil value)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-06, 15:05


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

polaczkos, co to jest reportView(tonumber(id)) masz t? funkcje zdefiniowan??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-06, 16:49


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

jest to z wy?wietlania

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-06, 16:59


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Podaj ca?y kod bo nie wiem ju? czy to tabela czy funkcja.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-06, 20:40


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

tutaj jest system reportow

function cmd_raport(plr, cmd, id, ...)
  if (not id) then
    outputChatBox("U?yj: /raport <id/nick> <powod>", plr)
    return
  end
  local target=getElementByID("id"..id)
  local target=exports["czaty"]:findPlayer(plr,id)
  if (not target) then
    outputChatBox("Nie odnaleziono gracza o podanym ID.", plr)
    return
  end
  local opis=table.concat(arg, " ")
  
    local report=('Report> %s(%d) zg?osi? %s(%d) za %s'):format(getPlayerName(plr),getElementData(plr,"id"), getPlayerName(target), getElementData(target,"id"), opis)
      triggerClientEvent(root, "admin:addReport", root, report)
  outputChatBox("Zg?oszenie zosta?o wys?ane." , plr)
end

addCommandHandler("raport", cmd_raport, false,false)
addCommandHandler("report", cmd_raport, false,false)

function cmd_cl(plr,cmd,id,...)
  if (not id) then
    outputChatBox("U?yj: /cl <id/nick> <powod>", plr)
    return
  end


  local powod=table.concat(arg, " ")
  if (string.len(powod)<2) then
    outputChatBox("U?yj: /cl <id/nick> <powod>", plr)
    return
  end

  local target=exports["czaty"]:findPlayer(plr,id)
  local opis="?"
  if (target) then
    id=getElementData(target,"id")
    opis=getPlayerName(target)
  end

  reportView(tonumber(id))
  local supportLogin=getElementData(plr, "admin:addText")
  msgToSupport(supportLogin .. " usun??/??a raport na " .. opis .. "/".. id .. ": " .. powod)
end
addCommandHandler("cl", cmd_cl, false, false)


atu jest wyswietlanie

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

addEventHandler("onClientRender", root, function()
    if getElementData(localPlayer,"duty") then
    concat=table.concat(gameView, "\n")
    dxDrawText(concat, sx*(10+1)/1024, sy*(279+1)/768, sx*(326+1)/1024, sy*(497+1)/768, tocolor(0, 0, 0, 255), 1.00, "default", "left", "top", false, true)
    dxDrawText(concat, sx*(10)/1024, sy*(279)/768, sx*(326)/1024, sy*(497)/768, white, 1.00, "default", "left", "top", false, true)
end
end)

function renderingInfo()
dxDrawRectangle(sx*(258)/1024, sy*(0)/768, sx*(500)/1024, sy*(23)/768, tocolor(0, 0, 0, 155), false)
    dxDrawText(xtext, sx*(258+1)/1024, sy*(0+1)/768, sx*(758+1)/1024, sy*(23+1)/768, tocolor(0, 0, 0, 255), 1.00, "default", "center", "center", false, true)
    dxDrawText(xtext, sx*(258)/1024, sy*(0)/768, sx*(758)/1024, sy*(23)/768, tocolor(255, 0, 0, 255), 1.00, "default", "center", "center", false, true)
end

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

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

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


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

addEvent("admin:rendering", true)
addEventHandler("admin:rendering", root, function(text)
    xtext=text
    addEventHandler("onClientRender", root, renderingInfo)
    setTimer(function()
        removeEventHandler("onClientRender", root, renderingInfo)
    end, 5000, 1)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-06, 21:06


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-10, 14:39


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

Dalej ten sam b?ad

[code]2017-03-06 14] ERROR: [Administracja]/admins-pol/reports.lua:49: attempt to call global 'reportView' (a nil value)
[code]

[ Dodano: 2017-03-12, 10:31 ]
Pomo?e kto? ?

[ Dodano: 2017-03-20, 20:31 ]
Ref

Postaw piwo autorowi tego posta
 

 
Tagi: usuwanie :: reportó
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