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

Wysłany: 2016-04-26, 15:28


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

Mam taki ma?y problem mam skrypty na zabieranie prawka po??czone z mysql
Problem le?y w 2 rzeczach 1. Gdy jestem "nowym" graczem moge odrazu do wszystkiego wsiada?.Problem 2 to jest ?e gdy mam zawieszony prawa jazdy nadal moge wsiadac a w db 3 nic nie pisze o bledzie
Daje wam linijki Kod?w oraz ss myqsl


Komenda admina na zabierania Prawka

addCommandHandler("zpj", function(plr,cmd,cel,time,type,...)
    if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1then
        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."plr25500)
            return
        end
        if isPedInVehicle(targetthen
            removePedFromVehicle(target)
        end
        result=pobierzDate(type,time)
        triggerClientEvent(root"admin:rendering"root"* "..getPlayerName(target).."("..getElementData(target,"id")..") otrzyma?/a zakaz prowadzenia pojazd?w kat(ABC) od "..getPlayerName(plr)..": "..reason.."("..time .. type ..")")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)"getPlayerSerial(target), reasonresult"A")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)"getPlayerSerial(target), reasonresult"B")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)"getPlayerSerial(target), reasonresult"C")
    end
end)



Tutaj le?y b??d DB3 gdy mam zawieszone prawko moge wsiadac i jak jestem nowym graczem to r?wnie? mog?


--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

-- Tutaj ustawiamy kategorie pojazd?w
local categoryA={463,462,461,581,448,468,471,521,522,523}
local categoryB={602545496517401410518600527436589580419439533549526491474445467604426507547585,
405587409466550492566546540551421516529488460,
469487510509481586472473493595484430453452446454485552,
438574420525408596597427599490432528601407544470598588,
532443486531543422583478605554530418572582536575534567535576412402542603475449537570441464501465564568557424504495457539483571500444556429411541559415561480560562506565451434558494555502477503579400404489505479442458606607610590569611584608435450591594}
local categoryC={403,406,413,414,416,423,428,431,433,437,440,455,456,459,482,498,499,508,514,515,524,538,573}
local categoryL={592,553,577,488,511,497,548,563,512,476,593,447,425,519,520,460,417,469,487,513}

-- Tutaj dalsza cze?c kodu
addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat == 0 then
        for i,v in ipairs(categoryA) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=1 AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=1 AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryB) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=2 AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=2 AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryL) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=3 AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=3 AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
    end
end)
addEventHandler("onResourceStart"resourceRoot, function() onRespawnVehicles(_,falseend)


Niby kod sprawdzajacy czy mamy prawka

-- Kod s?u??cy od sprawdzania prawa jazdy
function getVehicleLicense(plr,type)
    if getElementData(plr,"player:license:pj"..type.."") ~= 0 then
        outputChatBox("* Nie posiadasz prawa jazdy kategorii "..type..", zdaj je w urz?dzie miasta"plr25500)
        return
    end
    local result=exports["ogrpg-db"]:dbSet("SELECT * FROM ogrpg_punish WHERE serial=? AND type=? AND active=1 AND time>NOW()"getPlayerSerial(plr), tostring(type))
    if result and #result > 1 then
        v=result[1]
        outputChatBox("* Posiadasz zawieszone prawo jazdy do "..v.time.." za "..v.reasonplr)
        return true
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE serial=? AND type=? AND active=1 AND time<NOW()"getPlayerSerial(plr), tostring(type))
        return false
    end
end



By?o by to na tyle kod?w problem le?y w nich
SS: http://imgur.com/lMUUYzz

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-27, 14:59


Prezes.







Wiek: 27
Na forum: 4370 dni
Posty: 75
Nick w MP: Prezes.

Piwa: 17

Respekt: 60


addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat == 0 then
        for i,v in ipairs(categoryA) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=A AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=A AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryB) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=B AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=B AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryL) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=C AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=C AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
    end
end)
addEventHandler("onResourceStart"resourceRoot, function() onRespawnVehicles(_,falseend)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-27, 17:15


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

nadal mo?na wsiada? i b??d w db wyskakuje http://imgur.com/TelNPNe

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-27, 22:54


Prezes.







Wiek: 27
Na forum: 4370 dni
Posty: 75
Nick w MP: Prezes.

Piwa: 17

Respekt: 60

Sprawd? czy po tej zmianie wywala jakie? b??dy
              addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat == 0 then
        for i,v in ipairs(categoryA) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type='A' AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type='A' AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryB) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type='B' AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type='B' AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryL) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type='C' AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type='C' AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
    end
end)
addEventHandler("onResourceStart"resourceRoot, function() onRespawnVehicles(_,falseend)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-27, 23:03


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

teraz b??du nie ma lecz nadal mog? wsiada?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-27, 23:05


Prezes.







Wiek: 27
Na forum: 4370 dni
Posty: 75
Nick w MP: Prezes.

Piwa: 17

Respekt: 60

Bo nigdzie nie masz zablokowanego wsiadania jako nowy gracz - bynajmniej ja takiego kodu tutaj nie widz?.

Edit: Sprawd? czy takie co? zadzia?a, jak nie podaj ewentualne b??dy w DB3.


addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat == 0 then
        if (not getElementData(plr,"player:license:pjA") or getElementData(plr,"player:license:pjB") or getElementData(plr,"player:license:pjL")) then 
            cancelEvent() 
            outputChatBox("* Nie posiadasz odpowiednich uprawnie? aby kierowa? tym pojazdem.",plr)
            return false
            end
        for i,v in ipairs(categoryA) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type='A' AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type='A' AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryB) do
            if getElementModel(source) == v then
                
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type='B' AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type='B' AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
        for i,v in ipairs(categoryL) do
            if getElementModel(source) == v then
                local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type='C' AND active=1 AND serial=? AND time>NOW()"getPlayerSerial(plr))
                if #result > 0 then
                    cancelEvent()
                    outputChatBox("* Posiadasz zawieszone prawo jazdy do "..result[1].time..", za: "..result[1].reason..""plr)
                else
                    exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type='C' AND active=1 AND serial=?"getPlayerSerial(plr))
                end
            end
        end
    end
end)
addEventHandler("onResourceStart"resourceRoot, function() onRespawnVehicles(_,falseend)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-28, 00:34


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

w db3 b??du nie ma dzia?a ?e nie mog? wej?? do pojazdu lecz gdy zda?em prawo jazdy nadal nie mog? wej?c zrobi?em reconnecta i nic ;c

Postaw piwo autorowi tego posta
 

 
Tagi: zabieranie :: prawa :: jazdy :: czas :: myqsl
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