Wysłany: 2019-04-23, 23:18
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Witam ot?? ogarn??em sobie dzi?ki pomocy jednego z u?ytkownik?w tego forum usuwanie report?w z odpowiedziami, mam jeden problem nie mog? dobrze tego podpi?? by usuwa?o report z tabeli.
triggerEvent ( "admin:removeReport" , resourceRoot , id )
kod
s.lua
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
-- admins
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 getLevel ( plr )
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
--
function cmd_admins ( plr )
if not getElementData ( plr , "adminsON" ) then
local helperzy ={}
local supporterzy ={}
local admini ={}
local rconi ={}
local dev ={}
setElementData ( plr , "adminsON" , true )
setTimer ( setElementData , 30 * 1000 , 1 , plr , "adminsON" , false )
for i , v in ipairs ( getElementsByType ( "player" )) do
local adminer = getElementData ( v , "player:id" )
if ( getAdmin ( v , 4 )) then
local t
local login = getElementData ( v , "player:admin" )
if ( login ) then
t = "#ffffff" .. getPlayerName ( v ): gsub ( "#%x%x%x%x%x%x" , "" ).. "[#0066ffID:" .. getElementData ( v , "id" ).. "#ffffff]"
table . insert ( dev , t )
end
end
if ( getAdmin ( v , 3 )) then
local t
local login = getElementData ( v , "player:admin" )
if ( login ) then
t = "#ffffff" .. getPlayerName ( v ): gsub ( "#%x%x%x%x%x%x" , "" ).. "[#0066ffID:" .. getElementData ( v , "id" ).. "#ffffff]"
table . insert ( rconi , t )
end
end
if( getAdmin ( v , 2 )) then
local t
local login = getElementData ( v , "player:admin" )
if ( login ) then
t = "#ffffff" .. getPlayerName ( v ): gsub ( "#%x%x%x%x%x%x" , "" ).. "[#0066ffID:" .. getElementData ( v , "id" ).. "#ffffff]"
table . insert ( admini , t )
end
end
if ( getAdmin ( v , 1 )) then
local t
local login = getElementData ( v , "player:admin" )
if ( login ) then
t = "#ffffff" .. getPlayerName ( v ): gsub ( "#%x%x%x%x%x%x" , "" ).. "[#0066ffID:" .. getElementData ( v , "id" ).. "#ffffff]"
table . insert ( supporterzy , t )
end
end
end
outputChatBox ( "Developerzy:" , plr , 160 , 0 , 170 )
if ( #dev>0) then
outputChatBox ( " " .. table . concat ( dev , ", " ), plr , 255 , 255 , 255 , true )
else
outputChatBox ( "Brak." , plr )
end
outputChatBox ( "RCON:" , plr , 100 , 0 , 0 )
if ( #rconi>0) then
outputChatBox ( " " .. table . concat ( rconi , ", " ), plr , 255 , 255 , 255 , true )
else
outputChatBox ( "Brak." , plr )
end
outputChatBox ( "Administrator:" , plr , 255 , 0 , 0 )
if ( #admini>0) then
outputChatBox ( " " .. table . concat ( admini , ", " ), plr , 255 , 255 , 255 , true )
else
outputChatBox ( "Brak." , plr )
end
outputChatBox ( "Support:" , plr , 0 , 200 , 0 )
if ( #supporterzy>0) then
outputChatBox ( " " .. table . concat ( supporterzy , ", " ), plr , 255 , 255 , 255 , true )
else
outputChatBox ( "Brak." , plr )
end
end
end
addCommandHandler ( "admins" , cmd_admins , false , false )
addCommandHandler ( "admini" , cmd_admins , false , false )
addCommandHandler ( "ekipa" , cmd_admins , 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 ) then
local x = getElementData ( plr , "player:ucho" )
setElementData ( plr , "player:ucho" , not x )
end
end )
addCommandHandler ( "duty" , function( plr , cmd )
if getAdmin ( plr ) 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 )
setElementData ( plr , "player:premium" , true )
exports [ "noti" ]: noti ( "Zalogowa?e?[a?] si? na konto Administratora" , plr )
exports [ "noti" ]: noti ( "Wpisz /ucho by wy?wietli? podgl?d" , plr , 192 , 192 , 192 )
exports [ "ogrpg-db" ]: dbSet ( "UPDATE ogrpg_admins SET actived=NOW() WHERE serial=?" , getPlayerSerial ( plr ))
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
else
takeWeapon ( plr , 22 )
toggleControl ( plr , "fire" , false )
toggleControl ( plr , "aim_weapon" , false )
removeElementData ( plr , "player:admin" )
removeElementData ( plr , "player:level" )
removeElementData ( plr , "player:premium" )
exports [ "noti" ]: noti ( "Wylogowa?e? si? z duty administracji" , 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 )
rangi = {
[ 4 ] = "Developer" ,
[ 3 ] = "RCON" ,
[ 2 ] = "Administrator" ,
[ 1 ] = "Support" ,
}
scianarapsow = createObject ( 16637 ,- 1983.48 , 466.38 , 24235.17 )
setObjectScale ( scianarapsow , 3 )
reportView = {{ "OBECNE ZGLOSZENIA" , 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 > 10 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 ( "Poprawne u?ycie /report <Nick/ID?> <pow?d>" )
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 ({...}, " " )
CD = text
desc = getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. "(" .. getElementData ( plr , "id" ).. ") >> " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. "(" .. getElementData ( target , "id" ).. "): " .. text : gsub ( "#%x%x%x%x%x%x" , "" )
triggerEvent ( "admin:addReport" , resourceRoot , desc , getElementData ( target , "id" ))
triggerClientEvent ( root , "onDebugMessage" , resourceRoot , desc , 2 , "Report" )
exports [ "ogrpg-db" ]: dbSet ( "insert into logi_report SET data=NOW(),serial=?,nick=?,tresc=?" , getPlayerSerial ( target ), getPlayerName ( target ), CD )
outputChatBox ( "* Pomy?lnie wys?ano zg?oszenie na gracza: " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ), plr )
end )
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else -- podano fragment nicku
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter." , plr )
return nil
end
target = thePlayer
end
end
end
return target
end
addCommandHandler ( "cl" , function( plr , cmd , cel , ...)
local target = findPlayer ( plr , cel )
if ( not target ) then
outputChatBox ( "Nie znaleziono gracza " .. cel , plr )
return
end
local tresc = table . concat ( arg , " " )
if ( string . len ( tresc )<= 1 ) then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
outputChatBox ( "Wpisz tresc!" , plr )
return
end
triggerClientEvent ( "nadajOstrzezenie" , target , tresc )
end )
addEventHandler ( "onPlayerQuit" , root , function()
local id = getElementData ( source , "id" )
if id then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
end
end )
addCommandHandler ( "rapsy" , function( plr , cmd , uid )
if not getAdmin ( plr ) then
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 )
Wysłany: 2019-04-24, 10:32
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Chcesz ?eby usuwa?o report o wskazanym ID po wpisaniu komendy /cl?
Sprecyzuj si?, wklejasz po prostu linijk? i odpowiednio zmieniasz zmienn? ID w tym triggerze, ?eby wszystko dzia?a?o bez zarzut?w.
Wysłany: 2019-04-24, 12:35
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Wilq dok?adnie tak bym chcia?, lecz jak pisa?em niezbyt to ogarniam m?g?by? jako? to dopasowa? albo co? bardzo bym prosi?.
Wysłany: 2019-04-24, 13:33
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Podmie? sobie komend?:
addCommandHandler ( "cl" , function( plr , cmd , cel , ...)
local target = findPlayer ( plr , cel )
if ( not target ) then
outputChatBox ( "Nie znaleziono gracza " .. cel , plr )
return
end
local tresc = table . concat ( arg , " " )
if ( string . len ( tresc )<= 1 ) then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
outputChatBox ( "Wpisz tresc!" , plr )
return
end
triggerClientEvent ( "nadajOstrzezenie" , target , tresc )
local id = getElementData ( target , "id" )
if id then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
end
end )
Więcej szczegółów
Wystawiono 1 piw(a):Pyrek24
Wysłany: 2019-04-24, 14:06
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Dzi?kuj? ci bardzo WIlq. Sory, ?e tak ci? wykorzystuje ale mam pytanko da?o by si? doda?, ?e jak si? usunie raport to pisze ?e np Maciek usun?? raport na nick. I aby graczowi si? na czacie wy?wietla?o kto usun?? jego report.Prosi?bym bardzo pom?g?by? ?
Mam taki kod, lecz nwm gdzie go wstawi?
Kod: outputChatBox("* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." usun??/??a raport na: "..cel:gsub("#%x%x%x%x%x%x","").."/"..id..": "..reason, v, 255, 0, 0)
Wysłany: 2019-04-24, 17:11
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
addCommandHandler ( "cl" , function( plr , cmd , cel , ...)
local target = findPlayer ( plr , cel )
if ( not target ) then
outputChatBox ( "Nie znaleziono gracza " .. cel , plr )
return
end
local tresc = table . concat ( arg , " " )
if ( string . len ( tresc )<= 1 ) then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
outputChatBox ( "Wpisz tresc!" , plr )
return
end
triggerClientEvent ( "nadajOstrzezenie" , target , tresc )
local id = getElementData ( target , "id" )
if id then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
for _ , gracz in ipairs ( getElementsByType ( "player" )) do
outputChatBox ( "* " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " usun??/??a raport na: " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. "/" .. id .. ": " .. tresc , gracz , 255 , 0 , 0 )
end
end
end )
Wysłany: 2019-04-24, 17:55
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Mordko a tak ?eby gracz widzia? kto usun?? jego reporta? Np tw?j report zosta? usuni?ty przez i nick osoby kt?ra go usune?a. Dzi?kuje za tak? ogromn? pomoc !
Wysłany: 2019-04-24, 18:13
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
addCommandHandler ( "cl" , function( plr , cmd , cel , ...)
local target = findPlayer ( plr , cel )
if ( not target ) then
outputChatBox ( "Nie znaleziono gracza " .. cel , plr )
return
end
local tresc = table . concat ( arg , " " )
if ( string . len ( tresc )<= 1 ) then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
outputChatBox ( "Wpisz tresc!" , plr )
return
end
triggerClientEvent ( "nadajOstrzezenie" , target , tresc )
local id = getElementData ( target , "id" )
if id then
triggerEvent ( "admin:removeReport" , resourceRoot , id )
outputChatBox ( "Wstaw tutaj sw?j komunikat" , target , 255 , 0 , 0 )
for _ , gracz in ipairs ( getElementsByType ( "player" )) do
outputChatBox ( "* " .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " usun??/??a raport na: " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ).. "/" .. id .. ": " .. tresc , gracz , 255 , 0 , 0 )
end
end
end )
Wstaw sw?j komunikat w odpowiednie miejsce.
Wysłany: 2019-04-24, 19:07
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Dzi?kuje Bardzo. Temat do zamkni?cia.
Tagi: usuwanie :: reportów
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: