ddCommandHandler("zpj", function(plr,cmd,cel,time,rodzaj,...)
if getAdmin(plr,4) or 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 rodzaj 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
if tonumber(time) <= 0 then return end
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
if rodzaj == "m" then
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? minute,?)", getPlayerSerial(target),reason, time, "prawko")
elseif rodzaj == "h" then
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? hour,?)", getPlayerSerial(target),reason, time, "prawko")
elseif rodzaj == "d" then
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? day,?)", getPlayerSerial(target),reason, time, "prawko")
elseif rodzaj == "w" then
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,NOW() + INTERVAL ? week,?)", getPlayerSerial(target),reason, time, "prawko")
end
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 .. rodzaj ..")")
--local query = string.format("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')", getPlayerSerial(target), reason, result, "prawko")
--exports["ogrpg-db"]:dbSet(query)
--outputChatBox("* Dodanych rekord", plr)