addCommandHandler("zpj", function(plr,cmd,cel,time,type,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) or getAdmin(plr,4) 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/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
if isPedInVehicle(target) then
removePedFromVehicle(target)
end
--if getElementData(target,"player:uid") == 1 then outputChatBox("* Nie mo?na zabra? prawo jazdy graczowi o uid: 1 !",plr) return end
result=pobierzDate(type,time)
triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia pojazd?w kat(ABC) od ["..getElementData(plr,"id").."]"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..reason.."("..time .. type ..")")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("Otrzyma?e?(a?) zakaz prowadzenia pojazd?w od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("Pow?d: "..reason:gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("Czas: "..time .. type .."", target, 255, 255, 255)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
end
end)
addCommandHandler("zpl", 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: /zpl <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","L", getPlayerSerial(target))
local result=exports["DB2"]: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
if tonumber(time) <= 0 then return end
local result = "DATE()"
if rodzaj == "m" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d MINUTE)',time)
elseif rodzaj == "h" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d HOUR)',time)
elseif rodzaj == "d" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d DAY)',time)
elseif rodzaj == "w" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d WEEK)',time)
end
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia maszyn Lotniczych (L) "..reason.."("..time .. rodzaj ..")")
local query = string.format("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')", getPlayerSerial(target), reason, result, "L")
exports["ogrpg-db"]:dbSet(query)
end
end)
addCommandHandler("opl", function(plr,cmd,cel)
if getAdmin(plr,4) or 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["DB2"]: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
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_prawka_logs (komu_oddali,kto_oddal,typ) VALUES (?,?,?)", getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), "licencja lotnicza")
end
end)
[ Dodano: 2018-08-30, 19:16 ]
@Gravor, tak wszystko pod??czone. Bawi?em si? z ogrpg-core bo przecho nie dzia?a?o, a po wgraniu innego po prostu nie dzia?a, nie wiem co si? sta?o.
addCommandHandler("zpj", function(plr,cmd,cel,time,type,...)
if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) or getAdmin(plr,4) 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/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
if isPedInVehicle(target) then
removePedFromVehicle(target)
end
--if getElementData(target,"player:uid") == 1 then outputChatBox("* Nie mo?na zabra? prawo jazdy graczowi o uid: 1 !",plr) return end
result=pobierzDate(type,time)
triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia pojazd?w kat(ABC) od ["..getElementData(plr,"id").."]"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..reason.."("..time .. type ..")")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("Otrzyma?e?(a?) zakaz prowadzenia pojazd?w od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("Pow?d: "..reason:gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox("Czas: "..time .. type .."", target, 255, 255, 255)
outputChatBox(" ", target, 255, 0, 0)
outputChatBox(" ", target, 255, 0, 0)
end
end)
addCommandHandler("zpl", 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: /zpl <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","L", getPlayerSerial(target))
local result=exports["DB2"]: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
if tonumber(time) <= 0 then return end
local result = "DATE()"
if rodzaj == "m" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d MINUTE)',time)
elseif rodzaj == "h" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d HOUR)',time)
elseif rodzaj == "d" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d DAY)',time)
elseif rodzaj == "w" then
result = string.format('DATE_ADD(NOW(), INTERVAL %d WEEK)',time)
end
reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia maszyn Lotniczych (L) "..reason.."("..time .. rodzaj ..")")
local query = string.format("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')", getPlayerSerial(target), reason, result, "L")
exports["ogrpg-db"]:dbSet(query)
end
end)
addCommandHandler("opl", function(plr,cmd,cel)
if getAdmin(plr,4) or 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["DB2"]: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
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_prawka_logs (komu_oddali,kto_oddal,typ) VALUES (?,?,?)", getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), "licencja lotnicza")
end
end)
dodaj tak? instrukcj? warunkow?, zobaczymy czy zmienia dane w mysql
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
na
local pjA = exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
local pjB = exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
local pjC = exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
if pjA and pjB and pjC then
outputDebugString("dodano do mysql")
else
outputDebugString("NIE dodano do mysql")
end
Powinno wy?wietli? informacj? w DB3 gdy zabra?e? prawko o tym, czy dodano do mysql
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach