czy by? m?g? mi zrobi? taki owy skrypt lecz nie mog? si? po?apa? co i jak
[ Dodano: 2017-02-07, 21:02 ]
zrobi?em na zasadzie
addCommandHandler("zmutuj", 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: /zmutuj <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_mute WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","mute", getPlayerSerial(target))
local result=exports["goyd-db"]:pobierzWyniki(query)
if (result) then
return outputChatBox("Posiadasz mute "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
else
exports["goyd-db"]:dbSet("DELETE FROM ogrpg_mute WHERE type=? AND active=1 AND serial=?", "mute", 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, "* "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").."("..getElementData(target,"id")..") otrzyma?(a) Mute"..reason.."("..time .. rodzaj ..")")
local query = string.format("INSERT INTO ogrpg_mute (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')", getPlayerSerial(target), reason, result, "mute")
exports["goyd-db"]:dbSet(query)
--outputChatBox("* Dodanych rekord", plr)
end
end)
addCommandHandler("mute", function(plr,cmd,target,time,mutetype,...)
if getAdmin(plr) or getRcon(plr) then
if getElementData(plr, "player:admin") then
local reason=table.concat({...}, " ")
if not target or not time or not mutetype or not reason then
outputChatBox("* U?ycie: /mute [nick/ID] [czas] [jednostka: w/d/h/m] [pow?d]", plr)
return
end
local times=getRealTime()
time1=times.month+1
time2=times.monthday
time3=times.hour
time4=times.minute
if bantype=="w" then time1=time1+time end
if bantype=="d" then time2=time2+time end
if bantype=="h" then time3=time3+time end
if bantype=="m" then time4=time4+time end
date=string.format("%04d-%02d-%02d",times.year+1900,time1,time2)
xtime=string.format("%02d:%02d:00",time3,time4)
timing=date.." "..xtime
local target=exports["Duty"]:findPlayer(plr,target)
if not target then outputChatBox("* Nie odnaleziono podanego gracza.",plr) return end
exports["twojedb"]:dbGet("INSERT INTO mute (time,reason,serial,active) VALUES (?,?,?,1)", timing, reason, getPlayerSerial(target))
triggerClientEvent(root, "admin:rendering", root, "U?ytkownik "..getPlayerName(target).." zosta? wyciszony przez "..getPlayerName(plr)..". Pow?d: "..reason.."")
triggerClientEvent(root, "admin:addText", root, "MUTE> "..getPlayerName(plr).." wyciszyl "..getPlayerName(target).." Powod:"..reason)
end
end
end)
addCommandHandler("mute", function(plr,cmd,target,time,mutetype,...)
if getAdmin(plr) or getRcon(plr) then
if getElementData(plr, "player:admin") then
local reason=table.concat({...}, " ")
if not target or not time or not mutetype or not reason then
outputChatBox("* U?ycie: /mute [nick/ID] [czas] [jednostka: w/d/h/m] [pow?d]", plr)
return
end
local times=getRealTime()
time1=times.month+1
time2=times.monthday
time3=times.hour
time4=times.minute
if bantype=="w" then time1=time1+time end
if bantype=="d" then time2=time2+time end
if bantype=="h" then time3=time3+time end
if bantype=="m" then time4=time4+time end
date=string.format("%04d-%02d-%02d",times.year+1900,time1,time2)
xtime=string.format("%02d:%02d:00",time3,time4)
timing=date.." "..xtime
local target=exports["Duty"]:findPlayer(plr,target)
if not target then outputChatBox("* Nie odnaleziono podanego gracza.",plr) return end
exports["twojedb"]:dbGet("INSERT INTO mute (time,reason,serial,active) VALUES (?,?,?,1)", timing, reason, getPlayerSerial(target))
triggerClientEvent(root, "admin:rendering", root, "U?ytkownik "..getPlayerName(target).." zosta? wyciszony przez "..getPlayerName(plr)..". Pow?d: "..reason.."")
triggerClientEvent(root, "admin:addText", root, "MUTE> "..getPlayerName(plr).." wyciszyl "..getPlayerName(target).." Powod:"..reason)
end
end
end)
a masz strukture myql bo nie zbyt umiem tworzy? kolumny
addCommandHandler("xmute", function(plr,cmd,target,time,mutetype,...)
if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if getElementData(plr, "player:admin") then
local reason=table.concat({...}, " ")
if not target or not time or not mutetype or not reason then
outputChatBox("* U?ycie: /xmute [nick/ID] [czas] [jednostka: w/d/h/m] [pow?d]", plr)
return
end
local times=getRealTime()
time1=times.month+1
time2=times.monthday
time3=times.hour
time4=times.minute
if bantype=="w" then time1=time1+time end
if bantype=="d" then time2=time2+time end
if bantype=="h" then time3=time3+time end
if bantype=="m" then time4=time4+time end
date=string.format("%04d-%02d-%02d",times.year+1900,time1,time2)
xtime=string.format("%02d:%02d:00",time3,time4)
timing=date.." "..xtime
local target=exports["Duty"]:findPlayer(plr,target)
if not target then outputChatBox("* Nie odnaleziono podanego gracza.",plr) return end
exports["goyd-db"]:dbGet("INSERT INTO mute (time,reason,serial,active) VALUES (?,?,?,1)", timing, reason, getPlayerSerial(target))
triggerClientEvent(root, "admin:rendering", root, "U?ytkownik "..getPlayerName(target).." zosta? wyciszony przez "..getPlayerName(plr)..". Pow?d: "..reason.."")
triggerClientEvent(root, "admin:addText", root, "MUTE> "..getPlayerName(plr).." wyciszyl "..getPlayerName(target).." Powod:"..reason)
end
end
end)
b??d [2017-02-07 21] ERROR: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:713: exports: Call to non-running server resource (Duty) [string "?"]
Ostatnio zmieniony przez mis14 2017-02-07, 21:55, w całości zmieniany 2 razy
[2017-02-07 22:12:46] WARNING: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:715: Bad argument @ 'getPlayerSerial' [Expected player at argument 1, got string '1']
[2017-02-07 22:12:46] WARNING: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:716: Bad argument @ 'getPlayerName' [Expected element at argument 1, got string '1']
[2017-02-07 22:12:46] ERROR: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:716: attempt to concatenate a boolean value
jest kod edytowany
addCommandHandler("xmute", function(plr,cmd,target,time,mutetype,...)
if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
if getElementData(plr, "player:admin") then
local reason=table.concat({...}, " ")
if not target or not time or not mutetype or not reason then
outputChatBox("* U?ycie: /xmute [nick/ID] [czas] [jednostka: w/d/h/m] [pow?d]", plr)
return
end
local times=getRealTime()
time1=times.month+1
time2=times.monthday
time3=times.hour
time4=times.minute
if bantype=="w" then time1=time1+time end
if bantype=="d" then time2=time2+time end
if bantype=="h" then time3=time3+time end
if bantype=="m" then time4=time4+time end
date=string.format("%04d-%02d-%02d",times.year+1900,time1,time2)
xtime=string.format("%02d:%02d:00",time3,time4)
timing=date.." "..xtime
if not target then outputChatBox("* Nie odnaleziono podanego gracza.",plr) return end
exports["goyd-db"]:dbGet("INSERT INTO mute (time,reason,serial,active) VALUES (?,?,?,1)", timing, reason, getPlayerSerial(target))
triggerClientEvent(root, "admin:rendering", root, "U?ytkownik "..getPlayerName(target).." zosta? wyciszony przez "..getPlayerName(plr)..". Pow?d: "..reason.."")
end
end
end)
[ Dodano: 2017-02-07, 22:15 ]
tylko jak zrobi? potem wczytywanie
mis14, Nie chce nic m?wi? ale ten zapis czasu jest do bani poniewa? kiedy dasz mute od dnia 31.01.17 do 05.02.17(5 dni) to w mysql b?dzie co? takiego: 36.01.17
mis14, Nie chce nic m?wi? ale ten zapis czasu jest do bani poniewa? kiedy dasz mute od dnia 31.01.17 do 05.02.17(5 dni) to w mysql b?dzie co? takiego: 36.01.17
no w?a?nie te? si? zdziwi?em przerobi?em od prawa jazdy ale zczytywania nie umia?em zrobi?
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