Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-02-07, 19:54


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

witam w ogrpg jest system mute i nie wiem jak zrobi? ten skrypt aby zapisywa? mute i sprawdza? przy logowaniu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 19:56


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Podpinasz pod mysql i ropisz potem zapytanie podczas logowania czy ta osoba posiada mute.

[ Dodano: 2017-02-07, 20:06 ]
Zr?b od tego systemu mute po prostu export do bazy danych

Przyk?ad

exports["twojepo??czenie"]:dbGet("INSERT INTO mute (time,reason,serial,active) VALUES (?,?,?,1)"timingreasongetPlayerSerial(target))


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 20:44


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"xJakob" napisał/a:

Podpinasz pod mysql i ropisz potem zapytanie podczas logowania czy ta osoba posiada mute.

[ Dodano: 2017-02-07, 20:06 ]
Zr?b od tego systemu mute po prostu export do bazy danych

Przyk?ad

exports["twojepo??czenie"]:dbGet("INSERT INTO mute (time,reason,serial,active) VALUES (?,?,?,1)"timingreasongetPlayerSerial(target))
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,1then
        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."plr25500)
            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 (resultthen
            return outputChatBox("Posiadasz mute "..result["time"]..", za: "..result["reason"], plr25500)
        else
            exports["goyd-db"]:dbSet("DELETE FROM ogrpg_mute WHERE type=? AND active=1 AND serial=?""mute"getPlayerSerial(plr))
        end
        if isPedInVehicle(targetthen
            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), reasonresult"mute")
        exports["goyd-db"]:dbSet(query)
        --outputChatBox("* Dodanych rekord"plr)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 21:39


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

mis14,
Spr?buj ten kod:

addCommandHandler("mute", function(plr,cmd,target,time,mutetype,...)
    if getAdmin(plr) or getRcon(plrthen
        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)"timingreasongetPlayerSerial(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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 21:42


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"xJakob" napisał/a:

mis14,
Spr?buj ten kod:

addCommandHandler("mute", function(plr,cmd,target,time,mutetype,...)
    if getAdmin(plr) or getRcon(plrthen
        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)"timingreasongetPlayerSerial(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

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 21:44


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

No ale to powinno ci dzia?a? jak masz our game chyba ?e nie dzia?a to mog? ci udost?pni? mysql tylko napisz

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 21:49


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"xJakob" napisał/a:

No ale to powinno ci dzia?a? jak masz our game chyba ?e nie dzia?a to mog? ci udost?pni? mysql tylko napisz
`UID` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`Czas` datetime DEFAULT NULL,
`Powod` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL

addCommandHandler("xmute", function(plr,cmd,target,time,mutetype,...)
    if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1then
        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)"timingreasongetPlayerSerial(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  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 21:51


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Okej to napisz na pw a ja id? napisa? ci te tabele.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 22:14


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

[2017-02-07 22:12:46WARNING: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:715Bad argument 'getPlayerSerial' [Expected player at argument 1got string '1']
[2017-02-07 22:12:46WARNING: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:716Bad argument 'getPlayerName' [Expected element at argument 1got string '1']
[2017-02-07 22:12:46ERROR: [SKRYPTY]/[ogrpg]/dutyadmin/s_cmd.lua:716attempt 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,1then
        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)"timingreasongetPlayerSerial(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

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 22:30


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

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

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-07, 22:31


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"amited" napisał/a:

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?

Postaw piwo autorowi tego posta
 

 
Tagi: system :: mute
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku