To chyba fragment skryptu odpowiadaj?cy za to
</
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 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] = "#800080Developer",
[3] = "#123072Guardian",
[2] = "#ff0000Administrator",
[1] = "#006699Moderator",
[5] = "#00CC00Supporter",
[6] = "#FFA500Skrypter",
}
function wyswietl(plr,tabela)
if not plr then return end
if type(tabela) ~= "table" then outputChatBox("* Aktualnie nie ma administracji na duty",plr,255,0,0) return end
outputChatBox(" ✪ Dost?pna Administracja ✪ ",plr,255,0,0)
for _,s in pairs(tabela) do
outputChatBox("#ff0000"..(getElementData(s[1],"maafka") or "").."#ffffff "..getPlayerName(s[1]):gsub("#%x%x%x%x%x%x","").."#ff0000 ["..getElementData(s[1],"id").."".."] #ccc000"..s[2]:gsub("#%x%x%x%x%x%x","").."",plr,255,255,255,true)
end
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,"Ryjek") then
tabela[i] = {v,ranga}
ilosc = i
end
end
end
end
if ilosc < 1 then tabela = false end
wyswietl(plr,tabela)
end
function cmd_admins(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
if getElementData(v,"player:admin") then
local rank = getVisualRank(v)
if rank then
ranga = rank
else
ranga = rangi[tonumber(getLevel(v))]
end
if not getElementData(v,"Ryjek") then
tabela[i] = {v,ranga}
ilosc = i
end
end
end
end
end
if ilosc < 1 then tabela = false end
wyswietl(plr,tabela)
end
]]
--addCommandHandler("admins", cmd_admins, false, false)
--addCommandHandler("ekipa", cmd_admins, false, false)
function jestRCONem(gracz)
if getElementData(gracz, "player:level") == 4 then return true end
end
/>
[ Dodano: 2020-05-11, 10:56 ]
Ewentualnie to
</
addCommandHandler("duty", function(plr,cmd)
local pobierz = getElementData(plr,"player:uid")
local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=?", getPlayerSerial(plr))
if result and #result > 0 then
if pobierz == result[1].uid or pobierz == result[1].uid2 then
if getAdmin(plr,6) or getAdmin(plr,5) or 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", false)
toggleControl(plr, "action", 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)
elseif getAdmin(plr, 5) then
setElementData(plr,"player:level",5)
elseif getAdmin(plr, 6) then
setElementData(plr,"player:level",6)
end
setElementData(plr,"player:admin",true)
outputChatBox("#0053FF[#EBC79EInformacja#0053FF] #919191Zalogowa?e?(a?) si? na #FF0000duty#919191.", plr, 255, 255, 255, true )
outputChatBox("#0053FF[#EBC79EInformacja#0053FF] #919191Wpisz #FF0000/konsola#919191 aby wyswietlic tw?j interfejs#919191.", plr, 255, 255, 255, true )
local text = "* "..getPlayerName(plr).." zalogowa?(a) si? do administracji."..RGBToHex(255,255,255)
triggerEvent("admin:addText", resourceRoot, text,math.random(0,99))
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, "action", false)
toggleControl(plr, "aim_weapon", false)
removeElementData(plr,"player:admin")
removeElementData(plr,"player:level")
outputChatBox("#0053FF[#EBC79EInformacja#0053FF] #919191Wylogowa?e?(a?) si? z #FF0000duty#919191.", plr, 255, 255, 255, true )
local text = "* "..getPlayerName(plr).." wylogowa?(a) si? z administracji."..RGBToHex(255,255,255)
triggerEvent("admin:addText", resourceRoot, text,math.random(0,99))
end
end
else
end
end
end)
/>
|