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

Wysłany: 2018-07-20, 19:07


BoomEq







Wiek: 35
Na forum: 3522 dni
Posty: 101
Nick w MP: BoomEqqq

Piwa: 20

Respekt: 70

Witam, przerobi?em komputer policyjny z NewPlace na ogrpg. Gdy wpisuje id pojazdu lub gracza w komputer na komendzie to wyskakuje b??d w DB3:
GDY WPISUJE ID POJAZDU:
Kod:

WARNING: [db]/ogrpg-db/s_db.lua:27: dbPoll failed; Unknown column 'ownerPlayer' in 'field list'


GDY WPISUJE ID/NICK GRACZA:
[code[WARNING: [db]/ogrpg-db/s_db.lua:27: dbPoll failed; You have an error in your SQL syntax; check the manual that correspondes to your MariaDB server versiopn for the right syntax to use near 'FROM ogrpg_users WHERE id='1'at line 1 [/code]

Oto ca?y skrypt, serverside :
-- By madvalue <value2k@gmail.com>

local locations = {
    {2269.242448.45296.59int=0dim=16},    
};

addEventHandler("onResourceStart"resourceRoot, function ()
    for k,v in ipairs(locations) do
        local marker createMarker(v[1], v[2], v[3]-0.98"cylinder"122168125100);
        setElementInterior(markerv.int);
        setElementDimension(markerv.dim);

        local sphere createColSphere(v[1], v[2], v[3], 1);
        setElementInterior(spherev.int);
        setElementDimension(spherev.dim);

        addEventHandler("onColShapeHit"spherehitMDC);
    end
end);

function hitMDC(hitElementmatchDimensions)
    if getElementType(hitElement) ~= "player" or isPedInVehicle(hitElement) or not matchDimensions then return falseend

    if getElementData(hitElement"frakcja:sluzba") ~= "LSPD" then
        outputChatBox("Na ekranie wy?wietla si? napis 'Access Denied'"hitElement25500);
        return false;
    end

    triggerClientEvent(hitElement"showMDC"resourceRoot);
end

-----------------------------------
---- POBIERANIE DANYCH O AUCIE ----
-----------------------------------
addEvent("requestVehicleData"true);
addEventHandler("requestVehicleData"resourceRoot, function (uid)
    if not uid then return falseend

    local q exports['ogrpg-db']:wykonaj("SELECT model, login, ownerPlayer, id, plateText, parking, cosxd, police FROM ogrpg_vehicles, ogrpg_users WHERE id=? AND ownerPlayer=id"uid);
    if not q then
        exports['noti']:noti("Nie uda?o si? pobra? danych pojazdu - zg?o? to administracji"client"error");
        triggerClientEvent(client"reciveVehicleDetails"resourceRootfalse);
        return false;
    end

    if #q <= 0 then
        exports['noti']:noti("Nie znaleziono pojazdu o podanym uid"client"error");
        triggerClientEvent(client"reciveVehicleDetails"resourceRootfalse);
        return false;
    end

    local location "Nieznana";
    if q[1].przechowalnia 0 then
        location "Przechowalnia";
    elseif q[1].parking 0 then
        location "Parking wirtualny #" .. q[1].parking;
    elseif q[1].policyjny 0 then
        location "Parking policyjny";
    else
        local veh findVehicleByuid(q[1].id);
        if veh and isElement(vehthen
            local x,y,getElementPosition(veh);
            location getZoneName(x,y,z);
        end
    end

    local res = {
        ['model'] = getVehicleNameFromModel(q[1].model),
        ['owner'] = q[1].login,
        ['uid'] = q[1].id,
        ['plate'] = (utf8.len(q[1].rejestracja) > and q[1].rejestracja or "NP" .. q[1].id),
        ['location'] = location,
        ['servercount'] = ktoryNaSerwie(q[1].modelq[1].id)
    };

    triggerClientEvent(client"reciveVehicleDetails"resourceRoottrueres);
end);
----------------------------------------
---- ENDPOBIERANIE DANYCH O AUCIE ----
----------------------------------------


-----------------------------------
---- POBIRANIE DANYCH O GRACZU ----
-----------------------------------
addEvent("requestPlayerData"true);
addEventHandler("requestPlayerData"resourceRoot, function (uid)
    if not uid then return falseend

    local query "SELECT login, id, pjA, pjB, pjC FROM ogrpg_users WHERE login=?";
    if tonumber(uidthen
        query "SELECT login, id, pjA, pjB, pjC, FROM ogrpg_users WHERE id=?";
    end

    local q exports['ogrpg-db']:wykonaj(queryuid);
    if not q then
        exports['noti']:noti("Nie uda?o si? pobra? danych gracza - zg?o? to administracji"client"error");
        triggerClientEvent(client"recivePlayerDetails"resourceRootfalse);
        return false;
    end

    if #q <= 0 then
        exports['noti']:noti("Nie znaleziono gracza o podanej nazwie lub uid"client"error");
        triggerClientEvent(client"recivePlayerDetails"resourceRootfalse);
        return false;
    end

    local pq exports['ogrpg-db']:wykonaj("SELECT reason, time FROM ogrpg_punish WHERE serial=? AND time > NOW()"q[1].login);

    local prawko_block "Brak";
    if pq and #pq > 0 then
        prawko_block "Zawieszone do " .. pq[1].ts;    
    end

    local res = {
        ['login'] = q[1].login,
        ['uid'] = q[1].uid,
        ['player:license:pjA'] = (q[1].prawko_a and "#00FF00TAK" or "#FF0000NIE"),
        ['player:license:pjB'] = (q[1].prawko_b and "#00FF00TAK" or "#FF0000NIE"),
        ['player:license:pjC'] = (q[1].prawko_c and "#00FF00TAK" or "#FF0000NIE"),
        ['prawko_block'] = prawko_block
    };
    triggerClientEvent(client"recivePlayerDetails"resourceRoottrueres);
end);
----------------------------------------
---- ENDPOBIRANIE DANYCH O GRACZU ----
----------------------------------------


---------------
---- UTILS ----
---------------
function ktoryNaSerwie(modeluid)
    local counter 1;
    local q exports['ogrpg-db']:wykonaj("SELECT id FROM ogrpg_vehicles WHERE model=?"model);

    for k,v in ipairs(q) do
        if v.id == uid then 
            return counter;
        end
        counter counter 1;
    end

    return counter;
end

function findVehicleByuid(uid)
    for k,v in ipairs(getElementsByType("vehicle")) do
        if getElementData(v"id") and getElementData(v"id") == uid then return vend
    end
    return false;
end

function getTimestamp(yearmonthdayhourminutesecond)
    -- initiate variables
    local monthseconds = { 267840024192002678400259200026784002592000267840026784002592000267840025920002678400 }
    local timestamp 0
    local datetime getRealTime()
    yearmonthday year or datetime.year 1900month or datetime.month 1day or datetime.monthday
    hourminutesecond hour or datetime.hourminute or datetime.minutesecond or datetime.second
    
    -- calculate timestamp
    for i=1970year-do timestamp timestamp + (isLeapYear(i) and 31622400 or 31536000end
    for i=1month-do timestamp timestamp + ((isLeapYear(year) and == 2) and 2505600 or monthseconds[i]) end
    timestamp timestamp 86400 * (day 1) + 3600 hour 60 minute second
    
    timestamp timestamp 3600 --GMT+1 compensation
    if datetime.isdst then timestamp timestamp 3600 end
    
    return timestamp
end

function isLeapYear(year)
    if year then year math.floor(year)
    else year getRealTime().year 1900 end
    return ((year == and year 100 ~= 0) or year 400 == 0)
end
--------------------
---- ENDUTILS ----
--------------------



i clientside
-- By madvalue <value2k@gmail.com>

--------------------------
---- SKALOWANIE OBRAZU ---
--------------------------
local sw,sh guiGetScreenSize();
local zoom 1;
if sw 1920 then
    zoom math.min(21920/sw);
end

function sx(po) -- Skalowanie w osi x
    return (po/1920)*sw;
end

function sy(po) -- Skalowanie w osi y
    return (po/1080)*sh;
end
--------------------------------
---- ENDSKALOWANIE OBRAZU ----
--------------------------------


-------------------------
---- ZMIENNE LOKALNE ----
------------------------
local data = {
    enabled false, -- Czy kartoteka jest aktualnie pokazana
    textures = {}, -- Tekstury kt?ry saktualnie w pami?ci
    gui = {}, -- Aktualnie stworzone elementy gui
    button_hover nil, -- Przycisk na kt?rym aktualnie jest myszka
    state "search_vehicles", -- Stan komputera
    returned_details = {}, -- Informacje zwr?cone ze strony serwera
    vehicle_rows = {
        { "Model pojazdu""model" },
        { "W?a?ciciel""ownerPlayer" },
        { "id""id" },
        { "Tablica rejestracyjna""plateText" },
        { "Lokalizacja""location" },
        { "Kt?ry na serwerze""servercount" }
    },
    player_rows = {
        { "Nazwa gracza""login" },
        { "id""id" },
        { "Prawo jazdy kat. A""player:license:pjA" },
        { "Prawo jazdy kat. B""player:license:pjB" },
        { "Prawo jazdy kat. C""player:license:pjC" },
        { "Zawieszenie prawa jazdy""blokada" }
    },
};
------------------------------
---- ENDZMIENNE LOKALNE ----
------------------------------


-----------------------------
---- RYSOWANIE KARTOTEKI ----
-----------------------------
function render()
    -- Rysowanie t?a
    dxDrawImage(sx(410), sy(260), sx(1100), sy(600), data.textures.background);
    dxDrawImage(sx(360), sy(220), sx(1200), sy(900), data.textures.imac);

    if data.state == "main" then -- G??wne menu
        dxDrawImage(sx(780), sy(490), sx(150), sy(150), (data.button_hover == "main_vehicle" and data.textures.car_on or data.textures.car_off));
        dxDrawText("Samochody"sx(780), sy(630), sx(930), 00xFFFFFFFF1.5/zoom"default-bold""center");

        dxDrawImage(sx(980), sy(490), sx(150), sy(150), (data.button_hover == "main_users" and data.textures.user_on or data.textures.user_off));
        dxDrawText("Gracze"sx(980), sy(630), sx(1130), 00xFFFFFFFF1.5/zoom"default-bold""center");
    elseif data.state == "search_vehicles" then -- Wyszukiwanie pojazdu
        dxDrawText("Wpisz uid pojazdu aby go wyszuka? w policyjnej bazie"sx(410), sy(400), sx(1510), 00xFFFFFFFF1.5/zoom"default-bold""center");
        dxDrawImage(sx(810), sy(530), sx(300), sy(40), (data.button_hover == "search_vehicles_go" and data.textures.button_on or data.textures.button_off));
        dxDrawText("Szukaj"sx(810), sy(530), sx(1110), sy(570), 0xFFFFFFFF1/zoom"default-bold""center""center");
    elseif data.state == "search_users" then -- Wyszukiwanie gracza
        dxDrawText("Wpisz uid lub nazw? gracza aby go wyszuka? w policyjnej bazie"sx(410), sy(400), sx(1510), 00xFFFFFFFF1.5/zoom"default-bold""center");
        dxDrawImage(sx(810), sy(530), sx(300), sy(40), (data.button_hover == "search_users_go" and data.textures.button_on or data.textures.button_off));
        dxDrawText("Szukaj"sx(810), sy(530), sx(1110), sy(570), 0xFFFFFFFF1/zoom"default-bold""center""center");
    elseif data.state == "loading" then
        dxDrawText("Wczytywanie danych..."sx(410), sy(260), sx(1510), sy(860), 0xFFFFFFFF2/zoom"default-bold""center""center");
    elseif data.state == "show_vehicle" then
        dxDrawText("Szczeg??y pojazdu"sx(440), sy(290), 000xFF27CE732/zoom"default-bold");

        for i=1,#data.vehicle_rows do
            dxDrawRectangle(sx(550), sy(320 + (i*43)), sx(800), sy(40), 0xAA000000);
            dxDrawText(data.vehicle_rows[i][1], sx(565), sy(328 + (i*43)), 000xFF27CE731/zoom, (isElement(data.textures.czesc_malentas) and data.textures.czesc_malentas or "arial"));
            dxDrawText((data.returned_details[data.vehicle_rows[i][2]] and data.returned_details[data.vehicle_rows[i][2]] or "Brak danych"), sx(965), sy(328 + (i*43)), 000xFFFFFFFF1/zoom, (isElement(data.textures.czesc_malentas) and data.textures.czesc_malentas or "arial"));
        end
    elseif data.state == "show_player" then
        dxDrawText("Szczeg??y gracza"sx(440), sy(290), 000xFF27CE732/zoom"default-bold");

        for i=1,#data.player_rows do
            dxDrawRectangle(sx(550), sy(320 + (i*43)), sx(800), sy(40), 0xAA000000);
            dxDrawText(data.player_rows[i][1], sx(565), sy(328 + (i*43)), 000xFF27CE731/zoom, (isElement(data.textures.czesc_malentas) and data.textures.czesc_malentas or "arial"));
            dxDrawText((data.returned_details[data.player_rows[i][2]] and data.returned_details[data.player_rows[i][2]] or "Brak danych"), sx(965), sy(328 + (i*43)), 000xFFFFFFFF1/zoom, (isElement(data.textures.czesc_malentas) and data.textures.czesc_malentas or "arial"), "left""top"falsefalsefalsetrue);
        end
    end
    
    if data.state ~= "main" and data.state ~= "loading" then -- Ka?da podstrona
        dxDrawImage(sx(620), sy(790), sx(170), sy(40), (data.button_hover == "back_to_main" and data.textures.button_on or data.textures.button_off));
        dxDrawText("Powr?t"sx(620), sy(790), sx(790), sy(830), 0xFFFFFFFF1/zoom"default-bold""center""center");
    end

    dxDrawImage(sx(430), sy(790), sx(170), sy(40), (data.button_hover == "pc_exit" and data.textures.button_on or data.textures.button_off));
    dxDrawText("Zamknij komputer"sx(430), sy(790), sx(600), sy(830), 0xFFFFFFFF1/zoom"default-bold""center""center");
end
----------------------------------
---- ENDRYSOWANIE KARTOTEKI ----
----------------------------------


-----------------------------------------
---- POKAZYWANIE/UKRYWANIE KARTOTEKI ----
-----------------------------------------
function open() -- Pokazywanie kartoteki
    if data.enabled then return falseend

    showCursor(true);
    data.state "main";
    data.enabled true;
    outputDebugString("Otwieranie kartoteki, tworzenie tekstur [" .. getTickCount() .. "]");

    -- Elementy GUI
    data.gui.search_vehicle_uid guiCreateEdit(sx(810), sy(470), sx(300), sy(40), ""false);
    data.gui.search_player_uid guiCreateEdit(sx(810), sy(470), sx(300), sy(40), ""false);

    for i,v in pairs(data.gui) do
        guiSetVisible(vfalse);
    end

    -- Tworzenie potrzebnych tekstur
    data.textures.imac dxCreateTexture("assets/images/imac.png""argb"true"clamp");
    data.textures.background dxCreateTexture("assets/images/background.png""argb"true"clamp");
    data.textures.button_on dxCreateTexture("assets/images/button_on.png""argb"true"clamp");
    data.textures.button_off dxCreateTexture("assets/images/button_off.png""argb"true"clamp");
    data.textures.car_on dxCreateTexture("assets/images/car_on.png""argb"true"clamp");
    data.textures.car_off dxCreateTexture("assets/images/car_off.png""argb"true"clamp");
    data.textures.user_on dxCreateTexture("assets/images/user_on.png""argb"true"clamp");
    data.textures.user_off dxCreateTexture("assets/images/user_off.png""argb"true"clamp");

    data.textures.czesc_malentas dxCreateFont("assets/fonts/crosroadtonoob.ttf"12/zoom);

    outputDebugString("Tekstury dodane, dodawanie event?w [" .. getTickCount() .. "]");

    -- Dodawnie event?w
    addEventHandler("onClientRender"getRootElement(), render);
    addEventHandler("onClientCursorMove"getRootElement(), detectHover);
    addEventHandler("onClientClick"getRootElement(), detectClick);

    outputDebugString("Eventy dodane, kartoteka otwarta [" .. getTickCount() .. "]");
end
addEvent("showMDC"true);
addEventHandler("showMDC"resourceRootopen);


function close() -- Ukrywatnie kartoteki
    if not data.enabled then return falseend

    showCursor(false);
    data.enabled false;

    outputDebugString("Zamykanie kartoteki, usuwanie event?w [" .. getTickCount() .. "]");

    removeEventHandler("onClientRender"getRootElement(), render);
    removeEventHandler("onClientCursorMove"getRootElement(), detectHover);
    removeEventHandler("onClientClick"getRootElement(), detectClick);

    outputDebugString("Eventy usuni?te. Usuwanie tekstur z pami?ci [" .. getTickCount() .. "]");

    for i,v in pairs(data.textures) do -- P?tla na wszystkie tekstury
        if isElement(vthen destroyElement(vend -- Usuwanie teksturyje?li istnieje
    end
    data.textures = {}; -- Zerowanie tablicy z teksturami

    for i,v in pairs(data.gui) do -- P?tla na wszystkie elementy GUI
        if isElement(vthen destroyElement(vend -- Usuwanie elementu GUIje?li istnieje
    end
    data.gui = {}; -- Zerowanie tablicy z elementami GUI

    outputDebugString("Tekstury usuni?te, kartoteka zamkni?ta [" .. getTickCount() .. "]");
end
addEventHandler("onClientResourceStop"resourceRootclose);
----------------------------------------------
---- ENDPOKAZYWANIE/UKRYWANIE KARTOTEKI ----
----------------------------------------------


------------------------------
---- KLIKANIE/HOVEROWANIE ----
------------------------------
function detectHover(__xy)
    if sx(620) and sx(790) and sy(790) and sy(830) and data.state ~= "main" then data.button_hover "back_to_main"; -- Powr?do g??wnego menu
    elseif sx(780) and sx(930) and sy(490) and sy(640) and data.state == "main" then data.button_hover "main_vehicle"; -- Przycisk kategorii pojazdy
    elseif sx(980) and sx(1130) and sy(490) and sy(640) and data.state == "main" then data.button_hover "main_users"; -- Przycisk kategorii gracze
    elseif sx(810) and sx(1110) and sy(530) and sy(570) and data.state == "search_vehicles" then data.button_hover "search_vehicles_go"; -- Przycisk szukania w pojazdach
    elseif sx(810) and sx(1110) and sy(530) and sy(570) and data.state == "search_users" then data.button_hover "search_users_go"; -- Przycisk szukania w pojazdach
    elseif sx(430) and sx(600) and sy(790) and sy(830then data.button_hover "pc_exit"; -- Zamykanie komputera
    else data.button_hover nilend
end

function detectClick(buttonstate)
    if button ~= "left" or state ~= "down" then return end

    if data.button_hover == "back_to_main" then data.state "main"; -- Prze??czanie na wyb?r kategorii
    elseif data.button_hover == "main_vehicle" then data.state "search_vehicles"; -- Prze??czenie na szukanie pojazdu
    elseif data.button_hover == "main_users" then data.state "search_users"; -- Prze??czenie na szukanie gracza
    elseif data.button_hover == "search_vehicles_go" then -- Szukanie pojazdu w bazie danych
        local uid guiGetText(data.gui.search_vehicle_uid);
        if utf8.len(uid) <= 0 then
            outputChatBox("Musisz wpisa? uid wyszukiwanego pojazdu"25500);
            return false;
        end

        uid tonumber(uid);
        if not uid then
            outputChatBox("Wpisane uid jest b??dne"25500);
            return false;
        end

        data.state "loading";
        guiSetVisible(data.gui.search_vehicle_uidfalse);
        triggerServerEvent("requestVehicleData"resourceRootuid);
    elseif data.button_hover == "search_users_go" then -- Szukanie gracza w bazie danych
        local uid guiGetText(data.gui.search_player_uid);
        if utf8.len(uid) <= 0 then
            outputChatBox("Musisz wpisa? nazw? lub uid wyszukiwanego gracza"25500);
            return false;
        end

        data.state "loading";
        guiSetVisible(data.gui.search_player_uidfalse);
        triggerServerEvent("requestPlayerData"resourceRootuid);
    end 


    if data.state == "search_users" then
        guiSetVisible(data.gui.search_player_uidtrue);
    else
        guiSetVisible(data.gui.search_player_uidfalse);
    end

    if data.state == "search_vehicles" then
        guiSetVisible(data.gui.search_vehicle_uidtrue);
    else
        guiSetVisible(data.gui.search_vehicle_uidfalse);
    end


    if data.button_hover == "pc_exit" then close(); end
end
-----------------------------------
---- ENDKLIKANIE/HOVEROWANIE ----
-----------------------------------


----------------------------------
---- ZWRACANIE DANYCH POJAZDU ----
----------------------------------
addEvent("reciveVehicleDetails"true);
addEventHandler("reciveVehicleDetails"root, function (successresponse)
    if not success then
        data.state "search_vehicles";
        guiSetVisible(data.gui.search_vehicle_uidtrue);
        return false;
    end

    iprint(response);

    data.state "show_vehicle";
    data.returned_details response;
end);
---------------------------------------
---- ENDZWRACANIE DANYCH POJAZDU ----
---------------------------------------


---------------------------------
---- ZWRACANIE DANYCH GRACZA ----
---------------------------------
addEvent("recivePlayerDetails"true);
addEventHandler("recivePlayerDetails"root, function (successresponse)
    if not success then
        data.state "search_users";
        guiSetVisible(data.gui.search_player_uidtrue);
        return false;
    end

    iprint(response);

    data.state "show_player";
    data.returned_details response;
end);
--------------------------------------
---- ENDZWRACANIE DANYCH GRACZA ----
--------------------------------------






Je?eli kto? by m?g? pom?c to stawiam :piwo: :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-20, 19:29


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

BoomEq, Nie masz takiej kolumny ownerPlayer, musisz j? dorobi? albo wgraj baze z newplace i po prostu usu? all i zostaw t? kolumne

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-20, 19:30


BoomEq







Wiek: 35
Na forum: 3522 dni
Posty: 101
Nick w MP: BoomEqqq

Piwa: 20

Respekt: 70

Mam kolumn? ownerPlayer w ogrpg_vehicles

[ Dodano: 2018-07-20, 19:31 ]
Dobra sorry powalilo mi sie i wpisa?em owner zamiast owned

[ Dodano: 2018-07-20, 19:38 ]
Teraz mi wyskakuje ;

Kod:

WARNING: [db]/ogrpg-db/s_db.lua:27: dbPoll failed; Column 'id' in field list is ambiguous


[ Dodano: 2018-07-22, 15:59 ]
@ref

Postaw piwo autorowi tego posta
 

 
Tagi: komputer :: policyjyny
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