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: 4324 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,1) 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
        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), 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")
    end
end)



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


--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <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={602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585,
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 488, 460,
469, 487, 510, 509, 481, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552,
438, 574, 420, 525, 408, 596, 597, 427, 599, 490, 432, 528, 601, 407, 544, 470, 598, 588,
532, 443, 486, 531, 543, 422, 583, 478, 605, 554, 530, 418, 572, 582, 536, 575, 534, 
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 570, 441, 464, 501, 465, 564, 568, 557, 424, 504, 495, 457, 539, 483, 571, 500, 
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594}
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(_,false) end)


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", plr, 255, 0, 0)
        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.reason, plr)
        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: 28
Na forum: 4511 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(_,false) end)


Postaw piwo autorowi tego posta
 

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


CzarnaKobra







Wiek: 30
Na forum: 4324 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: 28
Na forum: 4511 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(_,false) end)


Postaw piwo autorowi tego posta
 

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


CzarnaKobra







Wiek: 30
Na forum: 4324 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: 28
Na forum: 4511 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(_,false) end)


Postaw piwo autorowi tego posta
 

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


CzarnaKobra







Wiek: 30
Na forum: 4324 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 » Zabieranie Prawa Jazdy na czas myqsl 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