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
-- Settings
function pobierzDate(type,time)
realTime=getRealTime()
type=tostring(type)
time=tonumber(time)
if time < 0 then return end
if type == "m" then if time > 59 then return end value1=realTime.minute+time else value1=realTime.minute end
if type == "h" then if time > 23 then return end value2=realTime.hour+time else value2=realTime.hour end
if type == "d" then if time > 31 then return end value3=realTime.monthday+time else value3=realTime.monthday end
if type == "w" then if time > 11 then return end value4=realTime.month+time else value4=realTime.month end
if value1 >= 60 then value1 = value1-60; value2=value2+1 end
if value2 >= 24 then value2 = value2-24; value3=value3+1 end
if value3 >= 31 then value3 = value3-31; value4=value4+1 end
date=string.format("%04d-%02d-%02d ", realTime.year+1900, value4+1, value3)
time=string.format("%02d:%02d:%02d", value2, value1, realTime.second)
--outputChatBox(date..time,root)
return date..time
end
addCommandHandler('e', function(plr,cmd, ...)
if not (...) then return end
local ranga = nil
local msg=table.concat({...}, " ")
if (getAdmin(plr,3)) then
ranga = "Rcon"
end
if (getAdmin(plr,2)) then
ranga = "Administrator"
end
if (getAdmin(plr,1)) then
ranga = "Moderator"
end
for _, p in pairs(getElementsByType('player')) do
if getAdmin(p) then
outputChatBox("[Czat Ekipy(/e)]"..getPlayerName(plr).."("..tonumber(getElementData(plr,"id"))..")".."["..ranga.."]:"..RGBToHex(255,255,255)..""..msg,p,60,172,120,true)
end
end
end)
-- Teksty
addCommandHandler("r", function(plr,cmd,...)
if getAdmin(plr,3) then
local text=table.concat({...}, " ")
outputChatBox(">> "..text, root, 100, 0, 0)
end
end)
addCommandHandler("a", function(plr,cmd,...)
if getAdmin(plr,2) or getAdmin(plr,3) then
local text=table.concat({...}, " ")
outputChatBox(">> "..text, root, 255, 0, 0)
end
end)
addCommandHandler("m", function(plr,cmd,...)
if getAdmin(plr,1) or getAdmin(plr,3) then
local text=table.concat({...}, " ")
outputChatBox(">> "..text, root, 0, 102, 0)
end
end)
--[[addCommandHandler("ogloszenie", function(plr,cmd,...)
if not getElementData(plr, "player:premium") then outputChatBox("*Brak uprawnien",plr,255,0,0) return end
local text=table.concat({...}, " ")
triggerClientEvent(root,"admin:rendering", root, "[PREMIUM] ("..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..") >> "..text)
end)]]
addCommandHandler("c", function(plr,cmd,...)
if getAdmin(plr,3) then
local text=table.concat({...}, " ")
outputChatBox(">> "..text, root, 0, 0, 0)
end
end)
addCommandHandler("notification", function(plr,cmd,tyr,...)
if getAdmin(plr,3) then
if not ... or not tyr then triggerClientEvent(plr,"addNotification",root,"Wpisz /notification [error/success/warning/info] (tekst) ","error") return end
local text=table.concat({...}, " ")
for _, p in pairs(getElementsByType('player')) do
triggerClientEvent(p,"addNotificatione",root,text,tyr)
end
end
end)
-- Komendy rcon?w
addCommandHandler("przepisz.gracz", function(plr,cmd,value)
if getAdmin(plr,3) then
local veh=getPedOccupiedVehicle(plr)
if not veh then
outputChatBox("* Nie siedzisz w poje?dzie.", plr, 255, 0, 0)
return
end
setElementData(veh,"vehicle:ownedPlayer",tonumber(value))
outputChatBox("* Przepisa?e?(a?) pojazd do gracza: "..value, plr)
end
end)
addCommandHandler("daj.kase", function(plr,cmd,cel,value)
if getAdmin(plr,3) then
if not cel or not tonumber(value) then
outputChatBox("* U?ycie: /daj.kase <nick/ID> <koszt>", 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
givePlayerMoney(target, value)
outputChatBox("* Otrzyma?e?(a?) od systemu "..value.." PLN", target)
end
end)
addCommandHandler("daj.ogp", function(plr,cmd,cel,value)
if getAdmin(plr,3) then
if not cel or not tonumber(value) then
outputChatBox("* U?ycie: /daj.ogp <nick/ID> <ilosc>", 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
setElementData(target,"player:reputation", getElementData(target,"player:reputation")+value)
outputChatBox("* Otrzyma?e?(a?) "..value.." Reputacji!", target)
end
end)
-- Komendy admin?w
addCommandHandler("jp", function(plr,cmd)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if isPedInVehicle(plr) then
removePedFromVehicle(plr)
end
if doesPedHaveJetPack(plr) then
removePedJetPack(plr)
else
givePedJetPack(plr)
end
end
end)
-- komendy support?w
addCommandHandler("przeladuj", function(plr,cmd,cel,...)
if getAdmin(plr,3) then
local reason=table.concat({...}, " ")
if not cel or not reason then
outputChatBox("* U?ycie: /przeladuj <nick/ID>", 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
triggerEvent("save:player",root,target)
triggerEvent("load:player",root,target)
end
end)
addCommandHandler("zaladuj", function(plr,cmd,cel,...)
if getAdmin(plr,3) then
local reason=table.concat({...}, " ")
if not cel or not reason then
outputChatBox("* U?ycie: /zaladuj <nick/ID>", 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
triggerEvent("load:player",root,target)
end
end)
addCommandHandler("przeladujall", function(plr,cmd,cel,...)
if getAdmin(plr,3) then
for i,v in ipairs(getElementsByType("player")) do
if isElement(v) then
triggerEvent("save:player",root,v)
triggerEvent("load:player",root,v)
end
end
outputChatBox("* Administrator przeladowal wszystkim statystyki", root, 21,0,170,true)
end
end)
addCommandHandler("zapisz", function(plr,cmd)
if getAdmin(plr,3) then
for i,v in ipairs(getElementsByType("player")) do
if isElement(v) then
triggerEvent("save:player",root,v)
end
end
outputChatBox("* Administrator zapisal wszystkim statystyki", root, 21,0,170,true)
end
end)
addCommandHandler("rozdajpienionzki", function(plr,cmd,pinion)
if not pinion then return end
if not tonumber(pinion) then return end
if getAdmin(plr,3) then
for i,v in ipairs(getElementsByType("player")) do
if isElement(v) then
givePlayerMoney(v,pinion)
end
end
outputChatBox("* Administrator doda? ka?demu graczowi "..pinion.." PLN", root, 255,0,0,true)
end
end)
addCommandHandler("k", function(plr,cmd,cel,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local reason=table.concat({...}, " ")
if not cel or not reason then
outputChatBox("* U?ycie: /kick <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
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") zosta?(a) wyrzucony(a) przez ' "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." ' z powodu: "..reason.."")
kickPlayer(target, plr, reason)
end
end)
addCommandHandler("kick", function(plr,cmd,cel,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local reason=table.concat({...}, " ")
if not cel or not reason then
outputChatBox("* U?ycie: /kick <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
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") zosta?(a) wyrzucony(a) przez "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..reason.."")
kickPlayer(target, plr, reason)
end
end)
addCommandHandler("prezent", function(plr, cmd, money)
if getAdmin(plr,3) or getAdmin(plr,2) then
if (not money) then
outputChatBox("U?yj: /prezent <hajsy>", plr)
return end
if not tonumber(money) then
outputChatBox("* /prezent <hahsy>", plr)
return end
money = tonumber(money)
if money <= 0 then
outputChatBox("* Za mala odleglosc", plr)
return end
if money > 10000 then
outputChatBox("* Za duza odleglosc maks 10k", plr)
return end
takePlayerMoney(plr,money)
local x,y,z = getElementPosition(plr)
local cub = createMarker (x,y+2,z ,"corona", 1, 255, 120, 255, 155 )
local t=createElement("text")
setElementPosition(t,x,y+2,z)
setElementData(t,"name","Prezent :)")
addEventHandler("onMarkerHit", cub, function(el, md)
if getElementType ( el) == "player" then
outputChatBox("*Gracz "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." zgarnia prezent o wartosci "..money.."PLN!",root,255,0,0)
givePlayerMoney(el,money)
destroyElement(source)
destroyElement(t)
end
end)
setTimer(function() if isElement(cub) then destroyElement(cub); destroyElement(t) end end,15000,1)
end
end)
addCommandHandler("tt", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("* U?ycie: /tt <nick/ID>", 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
if isPedInVehicle(plr) then
removePedFromVehicle(plr)
end
local x,y,z=getElementPosition(target)
setElementInterior(plr,getElementInterior(target))
setElementDimension(plr,getElementDimension(target))
setElementPosition(plr,x+math.random(1,2),y+math.random(1,2),z)
end
end)
addCommandHandler("th", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("* U?ycie: /th <nick/ID>", 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
if isPedInVehicle(target) then
removePedFromVehicle(target)
end
local x,y,z=getElementPosition(plr)
setElementInterior(target,getElementInterior(plr))
setElementDimension(target,getElementDimension(plr))
setElementPosition(target,x+math.random(1,2),y+math.random(1,2),z)
end
end)
addCommandHandler("warn", function(plr,cmd,cel,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local reason=table.concat({...}, " ")
if not cel or not reason then
outputChatBox("* U?ycie: /warn <nick/ID> <powod>", 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
outputChatBox("******************************", target, 255, 0, 0)
outputChatBox("* Otrzyma?e?(a?) ostrze?enie...", target, 255, 0, 0)
outputChatBox("* Nie stosowanie si? do ostrze?e?,", target, 255, 0, 0)
outputChatBox("* Mo?e skutkowa? kicki'em lub ban'em.", target, 255, 0, 0)
outputChatBox("*****************************", target, 255, 0, 0)
outputChatBox("Pow?d: "..reason, target, 255, 0, 0)
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzyma?(a) ostrze?enie od ' "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." ' z powodu: "..reason.."")
end
end)
addCommandHandler("zpj", function(plr,cmd,cel,time,type,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local reason=table.concat({...}, " ")
if not cel or not tonumber(time) or not type or not reason then
outputChatBox("* U?ycie: /zpj <nick/ID> <czas> <jednostka: m/h/d/w> <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 query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko", getPlayerSerial(target))
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
return outputChatBox(" Gracz Posiada zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
else
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "prawko", getPlayerSerial(plr))
end
if isPedInVehicle(target) then
removePedFromVehicle(target)
end
result=pobierzDate(type,time)
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzyma?(a) zakaz prowadzenia pojazd?w kat(ABC) "..reason.."("..time .. type ..")")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "prawko")
--outputChatBox("* Dodanych rekord", plr)
end
end)
addCommandHandler("zpl", function(plr,cmd,cel,time,type,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local reason=table.concat({...}, " ")
if not cel or not tonumber(time) or not type or not reason then
outputChatBox("* U?ycie: /zpl <nick/ID> <czas> <jednostka: m/h/y/w> <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 query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(target))
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
return outputChatBox(" Gracz Posiada zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
else
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(plr))
end
if isPedInVehicle(target) then
removePedFromVehicle(target)
end
result=pobierzDate(type,time)
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzyma?(a) zakaz prowadzenia pojazd?w lotniczych(L) "..reason.."("..time .. type ..")")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "L")
--outputChatBox("* Dodanych rekord", plr)
end
end)
addCommandHandler("opj", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("* U?ycie: /opj <nick/ID> ", 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 query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko", getPlayerSerial(target))
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "prawko", getPlayerSerial(target))
outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." odzyskal swoje prawo jazdy!", plr, 0, 255, 0)
outputChatBox("* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." oddal Twoje prawo jazdy!", target, 0, 255, 0)
else
outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." nie posiada zabranego prawka!", plr, 0, 255, 0)
end
end
end)
addCommandHandler("opl", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("* U?ycie: /opl <nick/ID> ", 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 query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(target))
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(target))
outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." odzyskal swoja Licencje!", plr, 0, 255, 0)
outputChatBox("* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." oddal Twoja Licencje!", target, 0, 255, 0)
else
outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." nie posiada zabranej Licencji!", plr, 0, 255, 0)
end
end
end)
addCommandHandler("ban", function(plr,cmd,cel,time,type,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local reason=table.concat({...}, " ")
if not cel or not tonumber(time) or not type or not reason then
outputChatBox("* U?ycie: /ban <nick/ID> <czas> <jednostka: m/h/d/w> <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
if (getAdmin(plr,3) == false) and getAdmin(target,3) then outputChatBox("Nie mozesz tego zrobic na rconie!",plr,255,0,0) return end
local query=string.format("SELECT * FROM ogrpg_ban WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","ban", getPlayerSerial(target))
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
return outputChatBox(" Gracz Posiada Bana do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
else
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_ban WHERE type=? AND active=1 AND serial=?", "ban", getPlayerSerial(target))
end
result=pobierzDate(type,time)
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
if not result then outputChatBox("*Wpisales zla date **",plr,255,0,0) return end
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzyma?(a) bana z powodu: "..reason.."("..time .. type ..")")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_ban (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "ban")
kickPlayer(target,reason)
--outputChatBox("* Dodanych rekord", plr)
end
end)
addCommandHandler("pban", function(plr,cmd,cel,...)
if getAdmin(plr,3) or getAdmin(plr,2) then
local reason=table.concat({...}, " ")
if not cel or not reason then
outputChatBox("* U?ycie: /pban <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
if (getAdmin(plr,3) == false) and getAdmin(target,3) then outputChatBox("Nie mozesz tego zrobic na rconie!",plr,255,0,0) return end
local query=string.format("SELECT * FROM ogrpg_ban WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","ban", getPlayerSerial(target))
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
return outputChatBox(" Gracz Posiada Bana do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
else
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_ban WHERE type=? AND active=1 AND serial=?", "ban", getPlayerSerial(target))
end
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzyma?(a) bana "..reason.."(Na zawsze!)")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_ban (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason,"2030-12-31 23:59:59", "ban")
kickPlayer(target,reason)
--outputChatBox("* Dodanych rekord", plr)
end
end)
addCommandHandler("unban", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) then
if not cel then
outputChatBox("* U?ycie: /unban <serial>", plr)
return
end
-- if string.len(cel) ~= 32 then return outputChatBox("* B??dny serial ", plr) end
local query=string.format("SELECT * FROM ogrpg_ban WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","ban", cel)
local result=exports["ogrpg-db"]:pobierzWyniki(query)
if (result) then
exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_ban WHERE type=? AND active=1 AND serial=?", "ban", cel)
outputChatBox("* Usunieto bana o serialu ("..cel..")!", plr, 0, 255, 0)
else
outputChatBox("* Nie wykryto bana o serialu ("..cel..")!", plr, 0, 255, 0)
end
end
end)
addCommandHandler("fix", function(plr,cmd)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local veh=getPedOccupiedVehicle(plr)
if not veh then
outputChatBox("* Nie znajdujesz si? w poje?dzie", plr)
return
end
setElementHealth(veh, 1000)
fixVehicle(veh)
end
end)
addCommandHandler("vtt", function(plr,cmd,vid)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not vid or not tonumber(vid) then return end
vid=tonumber(vid)
for i,v in ipairs(getElementsByType("vehicle")) do
local dbid=getElementData(v,"vehicle:id")
if dbid and tonumber(dbid) == vid then
local x,y,z=getElementPosition(v)
setElementPosition(plr,x,y,z+4)
setElementInterior(plr, getElementInterior(v))
setElementDimension(plr, getElementDimension(v))
if getAdmin(plr,3) then
warpPedIntoVehicle(plr,v)
end
return
end
end
local query=exports["ogrpg-db"]:dbGet("SELECT 1 FROM ogrpg_vehicles WHERE id=? AND parking>0", vid)
if query then
outputChatBox("* Pojazd znajduje sie na parkingu/w przechowalni.", plr, 255, 0, 0)
else
outputChatBox("* Nie znaleziono podanego pojazdu na mapie.", plr, 255, 0, 0)
end
end
end)
addCommandHandler("vth", function(plr,cmd,vid)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not vid or not tonumber(vid) then return end
vid=tonumber(vid)
for i,v in ipairs(getElementsByType("vehicle")) do
local dbid=getElementData(v,"vehicle:id")
if dbid and tonumber(dbid) == vid then
if getElementData(v,"vehicle:police_parking") then outputChatBox("*Auto jest na parkingu policyjnym!",plr,255,0,0) return end
local x,y,z=getElementPosition(plr)
setElementPosition(v,x,y,z+0.1)
setElementInterior(v, getElementInterior(plr))
setElementDimension(v, getElementDimension(plr))
if getAdmin(plr,3) then
warpPedIntoVehicle(plr,v)
end
return
end
end
local query=exports["ogrpg-db"]:dbGet("SELECT 1 FROM ogrpg_vehicles WHERE id=? AND parking>0", vid)
if query then
outputChatBox("* Pojazd znajduje sie na parkingu/w przechowalni.", plr, 255, 0, 0)
else
outputChatBox("* Nie znaleziono podanego pojazdu na mapie.", plr, 255, 0, 0)
end
end
end)
addCommandHandler("heal", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("Uzyj: /heal <id/nick>", 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
setElementHealth(target, 100)
outputChatBox("* Uleczy?e?(a?) gracza " ..getPlayerName(target):gsub("#%x%x%x%x%x%x",""), plr)
outputChatBox("* Zosta?e? uleczony(a) przez "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), target)
end
end)
addCommandHandler("checkserial", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("Uzyj: /checkserial <id/nick>", 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
outputChatBox("* Serial gracza("..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."): "..getPlayerSerial(target), plr)
end
end)
addCommandHandler("spec", function(plr,cmd,cel)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if not cel then
outputChatBox("Uzyj: /spec <id/nick>", 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 x,y,z=getElementPosition(plr)
removePedFromVehicle(plr)
setElementInterior(plr, getElementInterior(target))
setElementDimension(plr, getElementDimension(target))
setCameraTarget(plr, target)
setElementData(plr,"spec:pos",{x,y,z})
end
end)
addCommandHandler("specoff", function(plr,cmd)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local spec=getElementData(plr,"spec:pos")
if not spec then return end
setElementPosition(plr, spec[1], spec[2], spec[3])
setCameraTarget(plr, plr)
end
end)
function destroyBlipsAttachedTo(player)
local attached = getAttachedElements ( player )
if ( attached ) then
for k,element in ipairs(attached) do
if getElementType ( element ) == "blip" then
destroyElement ( element )
end
end
end
end
addCommandHandler("inv", function(plr)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if getElementAlpha(plr) > 0 then
setElementAlpha(plr,0)
destroyBlipsAttachedTo ( plr )
else
setElementAlpha(plr,255)
local newValue = getElementData(plr,"player:admin") -- find the new value
if newValue == true then
destroyBlipsAttachedTo (plr)
createBlipAttachedTo ( plr, 0, 2, 255, 255, 255 )
else
destroyBlipsAttachedTo ( plr )
createBlipAttachedTo ( plr, 0, 2, 255, 255, 255 )
end
end
end
end)
addCommandHandler("invveh", function(plr)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
local plr=getPedOccupiedVehicle(plr)
if not plr then return end
if getElementAlpha(plr) > 0 then
setElementAlpha(plr,0)
else
setElementAlpha(plr,255)
end
end
end)