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

Wysłany: 2016-02-13, 22:31


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

Witam mam taki kod:
--[[
lss-adminraporty oraz podgl?d log?w
@author Lukasz Biegaj <wielebny@bestplay.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
@license Dual GPLv2/MIT
@package MTA-XyzzyRP
@link https://github.com/lpiob/MTA-XyzzyRP GitHub
]]--


local text_display=textCreateDisplay()
local gameViewtextCreateTextItem ""0.010.3"medium"255,255,255,255,1,"left","top",255)
local reportView=textCreateTextItem""0.990.7"low"255,255,255,255,1,"right","top",255)
--textitem textCreateTextItem string textfloat xfloat y, [string priorityint red 255int green 0int blue 0int alpha 255float scale 1string alignX "left"string alignY "top"int shadowAlpha 0] )

textDisplayAddText text_displaygameView )
textDisplayAddText text_displayreportView )

local gameView_contents={ "Zas?b lss-admin zosta? zrestartowany" }
local reportView_contents={}

local time getRealTime()

local tn=string.format("%04d%02d%02d%02d%02d%02d-%02d.txt"time.year+1900time.monthtime.monthdaytime.hourtime.minutetime.secondmath.random(1,99))

local fh=fileCreate("logi/"..tn)
--fileClose(fh)

function outputLog(text)
  if (text and fhthen
    local time getRealTime()
    local ts=string.format("%04d%02d%02d%02d%02d%02d> "time.year+1900time.monthtime.monthdaytime.hourtime.minutetime.second)
    fileWrite(fhts..text.."\n")
    fileFlush(fh)
  end
end

outputLog("Logowanie rozpocz?te")


for i,v in ipairs(getElementsByType("player")) do
    local accName getAccountName getPlayerAccount ) )
    if accName and (isObjectInACLGroup ("user."..accNameaclGetGroup "Support" ) ) or isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) )) then
      textDisplayAddObserver text_display)
    end
end


function refresh_td()
  local tresc=table.concat(gameView_contents,"\n")
  textItemSetText gameViewtresc )
  local tt={}
  for i,v in ipairs(reportView_contents) do
      if (v[1]) then
          table.insert(tt,v[1])
      end
  end
  tresc=table.concat(tt,"\n")
  textItemSetText reportViewtresc )
end


function gameView_add(text)
  outputLog(text)
  table.insert(gameView_contents,text)
  if (#gameView_contents>10) then
    table.remove(gameView_contents,1)
  end
  refresh_td()
end

function reportView_remove(id)
  for i=#reportView_contents,1,-1 do --in ipairs(reportView_contents) do
    if (reportView_contents[i][2] and reportView_contents[i][2]==idthen
      table.remove(reportView_contents,i)
    end
  end
end

function reportView_add(text,id)
    if (string.len(text)>0then
      outputLog("RAPORT " .. text)
    end
  table.insert(reportView_contents,{text,id})
  if (#reportView_contents>10) then
    table.remove(reportView_contents,1)
  end
  refresh_td()
end

--setTimer(function()
--    reportView_add("")
--end5*60000,0)


addEventHandler("onPlayerQuit"root, function()
  local id=getElementData(source,"id")
  if (id and tonumber(id)) then
    reportView_remove(tonumber(id))
  end
end)

addEventHandler("onPlayerLogin"root,  function()
    local accName getAccountName getPlayerAccount source ) )
    if accName and isObjectInACLGroup ("user."..accNameaclGetGroup "Support" ) ) then
      textDisplayAddObserver text_displaysource )
      gameView_add("### " .. accName .. " zalogowa?/a si?.")
      setElementData(source,"admin:rank",1)
    elseif accName and isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then
      textDisplayAddObserver text_displaysource )
    end

end)

addEventHandler("onPlayerLogout"root,  function(acc)
  accName=getAccountNameacc )
  if (textDisplayIsObserver(text_displaysource)) then
      textDisplayRemoveObserver text_displaysource )
--      gameView_add("### " .. accName .. " wylogowa?/a si?.")
      removeElementData(source,"admin:rank")
  end
end)

addCommandHandler("ucho", function(plr,cmd)
  if (textDisplayIsObserver(text_displayplr)) then
      textDisplayRemoveObserver text_displayplr )
  else
      textDisplayAddObserver text_displayplr )
  end
end,true,false)


refresh_td()

I nie wiem jak podpi?? to pod te skrypty:
To jest skrypt na chat.
function onPlayerChatSend(msg,type)
if type == 0 then
cancelEvent()
local xygetElementPosition(source)
local col createColSphere(xyz30)
   for i,v in ipairs(getElementsWithinColShape(col"player")) do  
   outputChatBox"#90FF00("..getElementData(source,"id").."#90FF00)#ECFFD5"..getPlayerName(source)..":#90FF00"..msg,v255255255true)
   end
destroyElement(col)
end
    end
addEventHandler("onPlayerChat"getRootElement(), onPlayerChatSend)


function onPlayerChatDo(plr,commands, ...)
local msg table.concat ( {...}, " " )
local xygetElementPosition(plr)
local col createColSphere(xyz50)
for i,v in ipairs(getElementsWithinColShape(col"player")) do  
outputChatBox"#FF3000*"..getPlayerName(plr).." #FF3000"..msg.."#FF3000*",v255255255true)
end
destroyElement(col)
end
addCommandHandler("do",onPlayerChatDo)

function onPlayerChatSend(msg,type)
if type == 1 then
cancelEvent()
local xygetElementPosition(source)
local col createColSphere(xyz50)
   for i,v in ipairs(getElementsWithinColShape(col"player")) do  
   outputChatBox"#FF004E*"..getPlayerName(source).." #FF004E"..msg,v255255255true)
   end
destroyElement(col)
end
    end
addEventHandler("onPlayerChat"getRootElement(), onPlayerChatSend)

A to jest skrypt na pm:
function prywatne(plrcmdcel, ...)
    if (#arg<=0 or (not cel)) then
        outputChatBox("U?yj: /pm <nick/id> <tresc>"plr)
        return
    end
    
    local target findPlayer(plrcel)
    
    if (not targetthen
        outputChatBox("Nie znaleziono gracza o podanym ID/nicku!"plr)
        return
    end
    
    local pwoff getElementData(target"pwoff")
    
    if (pwoffthen
        outputChatBox(getPlayerName(target).." nie akceptuje wiadomo?ci PW."plr)
        if (type(pwoff)=="string"then
            outputChatBox("Pow?d: " .. pwoffplr)
        end
        return
    end
    
    if getElementData(plr"pwoff"then
        outputChatBox("Posiadasz wy??czone odbieranie wiadomo?ci, ta osoba nie b?dzie mog?a Ci odpisa?."plr)
    end
    
    local tresc table.concat(arg" ")
    outputChatBox("<< #919191".. getPlayerName(plr) .."#0053FF[".. getPlayerID(plr) .."]:#ffffff ".. tresctarget255255255true )
    outputChatBox(">> #919191".. getPlayerName(target) .."#0053FF["..getPlayerID(target) .."]:#ffffff ".. trescplr255255255true )
        outputDebugString ("PM  " ..getPlayerName(plr).. " - " ..getPlayerName(target).. " : " ..tresc)
    playSoundFrontEnd(target,12)
end
addCommandHandler("pm"prywatne)
addCommandHandler("pw"prywatne)

addCommandHandler("pmon", function(plrcmd)
  removeElementData(plr"pwoff")
  outputChatBox("(( Odbieranie wiadomo?ci w??czone. ))"plr)
  return
end)

addCommandHandler("pmoff", function(plrcmd, ...)
    local powod table.concat(arg" ")
    if (not powod or string.len(powod)<2then powod true end
    setElementData(plr"pwoff"powod)
    outputChatBox("(( Odbieranie wiadomo?ci wy??czone. ))"plr)
    return
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-13, 22:34


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Technika posz?a do przodu, zr?b to na dxDrawText : D

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-13, 22:36


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

"Jurandovsky" napisał/a:

Technika posz?a do przodu, zr?b to na dxDrawText : D


To jest skrypt z xyzzyrp i nie ogarniam wgl go xd Moglbys dac "gotowca" bo bede sie z tym meczyl

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-13, 22:45


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

musisz striggerowa? funkcj? od 'ucha' czyli od tego add_gameView czy jako? tak, do server-side i tam jej u?y? podaj?c jako argument to co napisa? gracz a nastepnie wy?wietli? ; p

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-13, 23:16


Patrix100

Amator LUA.






Wiek: 26
Na forum: 3887 dni
Posty: 182
Nick w MP: .:Patrix:.

Piwa: 952

Respekt: 40,5

"Jurandovsky" napisał/a:

musisz striggerowa? funkcj? od 'ucha' czyli od tego add_gameView czy jako? tak, do server-side i tam jej u?y? podaj?c jako argument to co napisa? gracz a nastepnie wy?wietli? ; p

Jest jeden problem xd nie potrafi? triggerowac

Postaw piwo autorowi tego posta
 

 
Tagi: jak :: podpiac :: skrypt?
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