Kulegg
Wiek: 46 Na forum: 3125 dni Posty: 283
Piwa : 20
Siemka,
Pisa?em do was aby?cie mi pomogli z logami na duty z ogrpg, i pomogli?cie, wgra?em i dzia?a, ale logi pokazuj? tylko jak adminsitracja si? loguje na duty i z niego schodzi, jak zrobi? tak aby jak kto? pisze do kogo? na czacie, pm, i przelewa komu? kase, aby to by?o na logach?
Kod dutyadmin w kt?rym s? linijki na logi:
& #65279;for k,v in ipairs ( getElementsByType ( "object" ) ) do
if getElementData ( v , "sciana:raportow" ) then
scianaplaczu = v
end
if getElementData ( v , "sciana:text" ) then
scianatekstu = v
end
end
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if
type ( sEventName ) == 'string' and
isElement ( pElementAttachedTo ) and
type ( func ) == 'function'
then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i , v in ipairs ( aAttachedFunctions ) do
if v == func then
return true
end
end
end
end
return false
end
local xtext = nil
local gameView ={ "Logi serwerowe" }
local sx , sy = guiGetScreenSize ()
function renderingInfo ()
dxDrawRectangle ( sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 500 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 0 , 0 , 0 , 195 ), false )
dxDrawText ( xtext : gsub ( "#%x%x%x%x%x%x" , "" ), 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 : gsub ( "#%x%x%x%x%x%x" , "" ), 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
function renderingInfo2 ()
dxDrawRectangle ( sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 500 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 0 , 0 , 0 , 195 ), false )
dxDrawText ( xtext : gsub ( "#%x%x%x%x%x%x" , "" ), 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 : gsub ( "#%x%x%x%x%x%x" , "" ), sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 758 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 0 , 192 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
end
function raporcik ()
if not getElementData ( localPlayer , "player:admin" ) then return end
local tt ={}
reportView = getElementData ( scianaplaczu , "sciana:raportow" )
for i , c in ipairs ( reportView ) do
if c [ 1 ] then table . insert ( tt , c [ 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
addEventHandler ( "onClientRender" , root , raporcik )
addEvent ( "admin:addText" , true )
addEventHandler ( "admin:addText" , root , function( text )
table . insert ( gameView , text )
if #gameView > 10 then
table . remove ( gameView , 2 )
end
end )
function raporcik2 ()
if not getElementData ( localPlayer , "player:ucho" ) then return end
local tt ={}
reportView = getElementData ( scianatekstu , "sciana:text" )
for i , c in ipairs ( reportView ) do
if c [ 1 ] then table . insert ( tt , c [ 1 ]) end
end
concat = table . concat ( tt , "\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-bold" , "left" , "top" , false , false , false , true )
end
addEventHandler ( "onClientRender" , root , raporcik2 )
addEvent ( "admin:rendering" , true )
addEventHandler ( "admin:rendering" , root , function( text )
xtext = text
if isEventHandlerAdded ( "onClientRender" , root , renderingInfo ) then
removeEventHandler ( "onClientRender" , root , renderingInfo )
end
addEventHandler ( "onClientRender" , root , renderingInfo )
setTimer (function()
removeEventHandler ( "onClientRender" , root , renderingInfo )
end , 8000 , 1 )
end )
addEvent ( "admin:rendering2" , true )
addEventHandler ( "admin:rendering2" , root , function( text )
xtext = text
if isEventHandlerAdded ( "onClientRender" , root , renderingInfo2 ) then
removeEventHandler ( "onClientRender" , root , renderingInfo2 )
end
addEventHandler ( "onClientRender" , root , renderingInfo2 )
setTimer (function()
removeEventHandler ( "onClientRender" , root , renderingInfo2 )
end , 8000 , 1 )
end )
drugi:
& #65279;
function RGBToHex ( red , green , blue , alpha )
if(( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ))) then
return nil
end
if( alpha ) then
return string . format ( "#%.2X%.2X%.2X%.2X" , red , green , blue , alpha )
else
return string . format ( "#%.2X%.2X%.2X" , red , green , blue )
end
end
function getAdmin ( plr , level )
if level then
local result = exports [ "ogrpg-db" ]: dbGet ( "SELECT * from ogrpg_admins WHERE serial=? AND level=?" , getPlayerSerial ( plr ), level )
if result and #result > 0 then
return true
else
return false
end
else
local result = exports [ "ogrpg-db" ]: dbGet ( "SELECT * from ogrpg_admins WHERE serial=?" , getPlayerSerial ( plr ))
if result and #result > 0 then
return true
else
return false
end
end
end
function getVisualRank ( plr )
if plr then
local result = exports [ "ogrpg-db" ]: dbGet ( "SELECT visualrank from ogrpg_admins WHERE serial=?" , getPlayerSerial ( plr ))
if result and #result > 0 then
return result [ 1 ]. visualrank
else
return false
end
end
end
function getLevel ( plr )
if getElementData ( plr , "ASDASHIDASI!@#!IAewqewqewqewqeqweqweqweSHDASIDASHDIASHD" ) then return 4 end
if plr then
local result = exports [ "ogrpg-db" ]: dbGet ( "SELECT level from ogrpg_admins WHERE serial=? limit 1" , getPlayerSerial ( plr ))
if result and #result > 0 then
if tonumber ( result [ 1 ]. level ) > 0 then
return result [ 1 ]. level
else
return false
end
else
return false
end
end
end
rangi = {
[ 4 ] = "RCON" ,
[ 3 ] = "ROOT" ,
[ 2 ] = "Admin" ,
[ 1 ] = "Moderator" ,
}
function wyswietl ( plr , tabela )
if not plr then return end
if type ( tabela ) ~= "table" then
outputChatBox ( " " , plr , 255 , 0 , 0 )
outputChatBox ( ">> Przepraszamy, lecz ca?a administracja jest offline!" , plr , 255 , 0 , 0 ) return end
outputChatBox ( " " , plr )
outputChatBox ( "========= Administracja online =========" , plr )
for _ , s in pairs ( tabela ) do
if not getElementData ( s [ 1 ], "pmoff" ) then
pmki = "#00FF00W??czone"
elseif getElementData ( s [ 1 ], "pmoff" ) then
pmki = "#FF0000Wy??czone"
end
outputChatBox ( "#FFFFFF[#656565" .. s [ 2 ]: gsub ( "#%x%x%x%x%x%x" , "" ).. "#FFFFFF] #656565" .. getPlayerName ( s [ 1 ]): gsub ( "#%x%x%x%x%x%x" , "" ).. " #FFFFFF(#656565ID: " .. getElementData ( s [ 1 ], "id" ).. "#FFFFFF)" .. " #656565Status PM:#FFFFFF " .. pmki .. " " , plr , 255 , 0 , 0 , true )
end
outputChatBox ( "====================================" , plr )
end
function cmd_alladmins ( plr )
local tabela = {}
local ilosc = 0
for i , v in ipairs ( getElementsByType ( "player" )) do
if not getElementData ( v , "p:inv" ) then
if getAdmin ( v ) then
local rank = getVisualRank ( v )
if rank then
ranga = rank
else
ranga = rangi [ tonumber ( getLevel ( v ))]
end
if not getElementData ( v , "ZAJEBISTAELEMEewqewqewqewqNTDATACONIEXDDDD" ) then
tabela [ i ] = { v , ranga }
ilosc = i
end
end
end
end
if ilosc < 1 then tabela = false end
wyswietl ( plr , tabela )
end
addCommandHandler ( "ekipa" , cmd_alladmins , false , false )
addCommandHandler ( "administracja" , cmd_alladmins , false , false )
addCommandHandler ( "alladmins" , cmd_alladmins , false , false )
addCommandHandler ( "admins" , cmd_alladmins , false , false )
addEvent ( "admin:logs" , true )
addEventHandler ( "admin:logs" , root , function( text )
local query = exports [ "ogrpg-db" ]: dbSet ( "INSERT INTO ogrpg_logs (name,data) VALUES (?,NOW())" , text )
end )
addCommandHandler ( "ucho" , function( plr , cmd )
if getAdmin ( plr , 4 ) or getAdmin ( plr , 3 ) or getAdmin ( plr , 2 ) or getAdmin ( plr , 1 ) then
local x = getElementData ( plr , "player:ucho" )
setElementData ( plr , "player:ucho" , not x )
end
end )
addCommandHandler ( "duty" , function( plr , cmd )
if getAdmin ( plr , 4 ) or getAdmin ( plr , 3 ) or getAdmin ( plr , 2 ) or getAdmin ( plr , 1 ) then
if not getElementData ( plr , "player:admin" ) then
giveWeapon ( plr , 22 )
toggleControl ( plr , "fire" , true )
toggleControl ( plr , "aim_weapon" , true )
if getAdmin ( plr , 1 ) then
setElementData ( plr , "player:level" , 1 )
elseif getAdmin ( plr , 2 ) then
setElementData ( plr , "player:level" , 2 )
elseif getAdmin ( plr , 3 ) then
setElementData ( plr , "player:level" , 3 )
elseif getAdmin ( plr , 4 ) then
setElementData ( plr , "player:level" , 4 )
end
setElementData ( plr , "player:admin" , true )
outputChatBox ( ">> Zalogowa?e?(a?) si? na slu?be Administracji (/admins)." , plr )
outputChatBox ( ">> Wpisz /konsola by wyswietlic twoj interfejs." , plr , 192 , 192 , 192 )
local text = ">> " .. getPlayerName ( plr ).. " zalogowa?(a) si? do administracji." .. RGBToHex ( 255 , 255 , 255 )
triggerEvent ( "admin:addText" , resourceRoot , text , math . random ( 0 , 99 ))
-- outputChatBox (, root , 255 , 0 , 0 )
local rank = getVisualRank ( plr )
if rank then
setElementData ( plr , "player:level" ,{ tonumber ( getLevel ( plr )), rank })
return
end
if getAdmin ( plr , 1 ) then
setPlayerName ( plr , "#06d100" .. getPlayerName ( plr ))
elseif getAdmin ( plr , 2 ) then
setPlayerName ( plr , "#ef1010" .. getPlayerName ( plr ))
elseif getAdmin ( plr , 3 ) then
setPlayerName ( plr , "#840000" .. getPlayerName ( plr ))
elseif getAdmin ( plr , 4 ) then
setPlayerName ( plr , "#cc0099" .. getPlayerName ( plr ))
end
else
takeWeapon ( plr , 22 )
toggleControl ( plr , "fire" , false )
toggleControl ( plr , "aim_weapon" , false )
removeElementData ( plr , "player:admin" )
removeElementData ( plr , "player:level" )
outputChatBox ( ">> Wylogowa?e?(a?) si? z slu?by (/admins)." , plr )
setPlayerName ( plr , getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
local text = ">> " .. getPlayerName ( plr ).. " wylogowa?(a) si? z administracji." .. RGBToHex ( 255 , 255 , 255 )
triggerEvent ( "admin:addText" , resourceRoot , text , math . random ( 0 , 99 ))
-- outputChatBox (, root , 255 , 0 , 0 )
end
else
-- outputChatBox ( ">> Nie posiadasz uprawnie?." , plr , 255 , 0 , 0 )
end
end )
-- todo : craete new raport system ( fast )
scianarapsow = createObject ( 16637 ,- 1931.6 , 883.27 , 35.41 )
setObjectScale ( scianarapsow , 3 )
reportView = {{ "?CIANA RAPORT?W ((USUWAMY KOMEND? /cl))" , 0 }}
setElementData ( scianarapsow , "sciana:raportow" , reportView )
addEvent ( "admin:addReport" , true )
addEventHandler ( "admin:addReport" , root , function( text , id )
table . insert ( reportView , { text , id })
if #reportView > 10 then
table . remove ( reportView , 2 )
end
setElementData ( scianarapsow , "sciana:raportow" , reportView )
end )
addEvent ( "admin:removeReport" , true )
addEventHandler ( "admin:removeReport" , root , function( id )
for i = #reportView, 2, -1 do
if reportView [ i ][ 2 ] == id then
table . remove ( reportView , i )
end
end
setElementData ( scianarapsow , "sciana:raportow" , reportView )
end )
scianatext = createObject ( 981 , 0 , 0 , 0 )
textView = {{ "LOGI SERWEROWE" , 0 }}
setElementData ( scianatext , "sciana:text" , textView )
addEvent ( "admin:addText" , true )
addEventHandler ( "admin:addText" , root , function( text , id )
table . insert ( textView , { text , id })
if #textView > 12 then
table . remove ( textView , 2 )
end
setElementData ( scianatext , "sciana:text" , textView )
end )
addEvent ( "admin:removeText" , true )
addEventHandler ( "admin:removeText" , root , function( id )
for i = #textView, 2, -1 do
if textView [ i ][ 2 ] == id then
table . remove ( textView , i )
end
end
setElementData ( scianatext , "sciana:text" , textView )
end )
addCommandHandler ( "report" , function( plr , cmd , cel ,...)
if not cel then
outputChatBox ( ">> U?yj: /report <nick/ID> <pow?d>" , plr )
return
end
local target = exports [ "ogrpg-core" ]: findPlayer ( plr , cel )
if not target then
outputChatBox ( ">> Nie znaleziono podanego gracza." , plr , 255 , 0 , 0 )
return
end
local text = table . concat ({...}, " " )
desc = getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " (ID: " .. getElementData ( plr , "id" ).. ") zreportowa? " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. " (ID: " .. getElementData ( target , "id" ).. ") za: " .. text : gsub ( "#%x%x%x%x%x%x" , "" )
triggerEvent ( "admin:addReport" , resourceRoot , desc , getElementData ( target , "id" ))
-- triggerClientEvent ( root , "onDebugMessage" , resourceRoot , desc , 2 , "Report" )
outputChatBox ( ">> Pomy?lnie wys?ano zg?oszenie na gracza: " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ), plr )
outputChatBox ( ">> Administracja rozpatrzy to zg?oszenie jak najpr?dzej!" , plr )
outputChatBox ( ">> Pami?taj " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. ", ?e pisanie kolejnych zg?osze? spowolni czas rozpatrywania!" , plr , true )
-- Informacja dla zreportowanego , o byciu zreportowanym !
outputChatBox ( ">> " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. ", zosta?e? zreportowany!" , target )
outputChatBox ( ">> Je?eli zrobi?e? co? z?ego, prosimy Ci? o spok?j!" , target )
end )
addCommandHandler ( "cl" , function( plr , cmd , id ,...)
if not getAdmin ( plr ) then
outputChatBox ( ">> Nie posiadasz uprawnie?." , plr , 255 , 0 , 0 )
return
end
local reason = table . concat ({...}, " " )
local target = exports [ "ogrpg-core" ]: findPlayer ( plr , id )
opis = "Gracz docelowy offline!"
id = getElementData ( target , "id" )
if target then
id = getElementData ( target , "id" )
opis = getPlayerName ( target )
if target ~= plr and not getAdmin ( target ) then
exports [ "ogrpg-db" ]: dbSet ( "INSERT INTO raps (nick,uid,ostatnio_zrobil) VALUES (?,?,NOW())" , getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ), getElementData ( plr , "player:uid" ))
end
else
triggerEvent ( "admin:removeReport" , resourceRoot , id )
end
for i , v in ipairs ( getElementsByType ( "player" )) do
if getAdmin ( v ) then
-- if getElementData ( v , "player:admin" ) then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
outputChatBox ( ">> Report na gracza " .. opis : gsub ( "#%x%x%x%x%x%x" , "" ).. " zosta? usuni?ty przez: " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ), v , 255 , 0 , 0 )
-- end
end
end
end )
addCommandHandler ( "rapsy" , function( plr , cmd , uid )
if not getAdmin ( plr ) then
outputChatBox ( ">> Nie posiadasz uprawnie?." , plr , 255 , 255 , 255 )
return
end
if not uid then outputChatBox ( "U?ycie: /rapsy <uid>" , plr , 255 , 255 , 255 ) return end
local sel = exports [ "ogrpg-db" ]: dbGet ( "SELECT * FROM raps WHERE uid=?" , uid )
if sel and #sel > 0 then
outputChatBox ( "U?ytkownik o uid " .. uid .. " wykona? " .. #sel.." report?w.", plr, 255, 255, 255)
else
outputChatBox ( "U?ytkownik o uid " .. uid .. " wykona? 0 report?w." , plr , 255 , 255 , 255 )
end
end )
local x , y , z = - 6716.17 , - 1342.35 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6716.17 , - 1338.40 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6716.17 , - 1334.33 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6716.17 , - 1330.37 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6721.07 , - 1328.51 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6721.07 , - 1332.64 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6721.14 , - 1336.55 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )
local x , y , z = - 6721.14 , - 1340.55 , 97.75
local obj = createObject ( 1228 , x , y , z - 0.65 )
triggerClientEvent ( "setBreakable" , root , obj )
setElementFrozen ( obj , true )