addCommandHandler('mute', function(plr,cmd,cel,time,type, ...)
if getAdmin(plr) then
local text = table.concat({...}, " ")
if not cel or not tonumber(time) or not type or not text then
outputChatBox("#00ff96(ⓘ) #FFFFFFU?ycie: /mute <nick/ID> <czas> <jednostka: m/h/y/w> <pow?d>", plr, 255,255,255, true)
return
end
local target=exports["pystories-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("#00ff96(✖) #FFFFFFNie znaleziono podanego gracza.", plr, 255, 255, 255, true)
return
end
local czas_tabela=pobierzDate(type,time)
triggerClientEvent(getRootElement(), "prawko_noti", getRootElement(), "Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma? kar? wyciszenia od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." ("..time .. type ..") z powodem: "..text, text)
if type == "m" then
exports["pystories-db"]:dbSet("INSERT INTO n_mute (serial,reason,time) VALUES (?,?,NOW() + INTERVAL ? minute)",getPlayerSerial(target),text,time)
elseif type == "h" then
exports["pystories-db"]:dbSet("INSERT INTO n_mute (serial,reason,time) VALUES (?,?,NOW() + INTERVAL ? hour)", getPlayerSerial(target),text, time)
elseif type == "d" then
exports["pystories-db"]:dbSet("INSERT INTO n_mute (serial,reason,time) VALUES (?,?,NOW() + INTERVAL ? day)", getPlayerSerial(target),text, time)
elseif type == "w" then
exports["pystories-db"]:dbSet("INSERT INTO n_mute (serial,reason,time) VALUES (?,?,NOW() + INTERVAL ? week)", getPlayerSerial(target),text, time)
end
setElementData(target,'player:mute',true)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("#00ff96(ⓘ) #FFFFFFOtrzyma?e?(a?) kar? wyciszenia od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255, true)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("#00ff96(ⓘ) #FFFFFFPow?d: "..text:gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255, true)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("#00ff96(ⓘ) #FFFFFFCzas: "..time .. type .."", target, 255, 255, 255, true)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
end
end)
addCommandHandler('unmute', function(plr,cmd,cel)
if getAdmin(plr) then
if not cel then
outputChatBox("#00ff96(ⓘ) #FFFFFFU?ycie: /unmute <nick/ID>", plr, 255,255,255, true)
return
end
local target=exports["pystories-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("#00ff96(✖) #FFFFFFNie znaleziono podanego gracza.", plr, 255, 255, 255, true)
return
end
triggerClientEvent(getRootElement(), "prawko_noti", getRootElement(), "Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." zosta? odciszony przez "..getPlayerName(plr):gsub("#%x%x%x%x%x%x",""))
setElementData(target,'player:mute',false)
exports['pystories-db']:dbSet('delete from n_mute where serial=?',getPlayerSerial(target))
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("#00ff96(ⓘ) #FFFFFFZosta?e? odciszony przez: "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255, true)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
end
end)