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

Wysłany: 2019-12-28, 14:03


daybreakx3







Wiek: 27
Na forum: 2413 dni
Posty: 11
Nick w MP: Daybreak

Piwa: 2

Respekt: 50

Witam Serdecznie czytaj?cych chcia?bym uzyska? pomoc w zmienianiu nazw pojazd?w w przecho oraz salonie Kody mog? wys?a? je?li kto? b?dzie sk?ony pomoc, jest tu wiele post?w na ten temat ale ?aden z tych opis?w co tam s? nie dzia?a... pr?bowa?em ju? wszystkiego pr?bowa?em sam kod pisa? i nici... dlatego te? zwracam si? tu o pomoc... bardzo bym by? wdzi?czny je?li kto? by m?g? udzieli? pomocy

Kod przecho od strony clienta

local screenWscreenH guiGetScreenSize()
local marker=createMarker(1680.59, -1364.8417.49"cylinder"1.3515350204)
exports.ps_markers:createCustomMarker(marker"garage")
local sphere=createColSphere(1680.59, -1364.8417.445)
local mileage ""

local wm={} 
wm.gridlist=guiCreateGridList(0.340.390.3330.24true)
guiGridListAddColumn(wm.gridlist"ID Pojazdu"0.3)
guiGridListAddColumn(wm.gridlist"Model"0.3guiGridListAddColumn(wm.gridlist"Kierowca"0.3)
guiSetVisible(wm.gridlistfalse)

panel false

function PrzechoGUI()

local AlphaAlpha2 interpolateBetween(0002551800, ((getTickCount() - czas) / 2500), "Linear"local r2,g2,b2=interpolateBetween(255,255,255,20,250,0,(getTickCount()-czas)/1100,"SineCurve")
local r,g,b=interpolateBetween(255,255,255,255,0,0,(getTickCount()-czas)/1100,"SineCurve"exports["buttons"]:createCustomWindow("Przechowalnia Pojazd?w"screenW 0.3016screenH 0.2786screenW 0.4092screenH 0.4805tocolor(255255255255), false)
exports["buttons"]:createCustomWindow("Dane Pojazdu"screenW 0.7416screenH 0.2786screenW 0.2492screenH 0.3805tocolor(255255255255), false)
exports["buttons"]:createCustomButton(""screenW 0.3392screenH 0.6719screenW 0.1094screenH 0.0600tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton(""screenW 0.5632screenH 0.6719screenW 0.1094screenH 0.0600tocolor(255,255,255,255), false)
dxDrawText("Wyjmij pojazd"screenW 0.3422screenH 0.7132screenW 0.4422screenH 0.6875tocolor(255255255Alpha), 1.14"default-bold""center""center"falsefalsefalsefalsefalse)
        
dxDrawText("Zamknij okno"screenW 0.5622screenH 0.7132screenW 0.6728screenH 0.6888tocolor(255255255Alpha), 1.14"default-bold""center""center"falsefalsefalsefalsefalse)
end


addEvent("onParkingGetVehicles"true)
addEventHandler("onParkingGetVehicles"root, function(result)
    guiGridListClear(wm.gridlist)
    if not result then return end
    for i,v in pairs(result) do
        local row=guiGridListAddRow(wm.gridlist)
        guiGridListSetItemText(wm.gridlistrow1v["id"], falsefalse)
        guiGridListSetItemText(wm.gridlistrow2getVehicleNameFromModel(v["model"]), falsefalse)
        guiGridListSetItemText(wm.gridlistrow3v["driver"]:gsub("#%x%x%x%x%x%x",""), falsefalse)
        if v["ownedGroup"] ~= "0" then 
        guiGridListSetItemColor wm.gridlistrow215351255 )
        else
        guiGridListSetItemColor wm.gridlistrow2255255255 )
        end
        if v["rent"] ~= "0" then 
        guiGridListSetItemColor wm.gridlistrow12550)
        else
        guiGridListSetItemColor wm.gridlistrow1255255255 )
        end
    end
end)

addEvent("setInfoFromID",true)
addEventHandler("setInfoFromID",root,function(q)
for i,v in pairs(q) do
mileage v["mileage"]
pojemnosc v["silnik"]
rodzaj v["rodzaj"]
bak v["bak"]
if v["GazZamont"] == 'Tak' then
    gaz "LPG, "
else
    gaz ""
end
if v["up1"] == 1 then
mk1 "MK1"
else
mk1 ""
end
if v["licznik"] == "blekit" then
kolorl "Licznik (#005cff█#ffffff),"
elseif v["licznik"] == "czerw" then
kolorl "Licznik (#FF0000█#ffffff),"
elseif v["licznik"] == "nieb" then
kolorl "Licznik (#0000ff█#ffffff),"
elseif v["licznik"] == "zolty" then
kolorl "Licznik (#ffff00█#ffffff),"
elseif v["licznik"] == "roz" then
kolorl "Licznik (#ff00ff█#ffffff),"
elseif v["licznik"] == "turkus" then
kolorl "Licznik (#00ffff█#ffffff),"
elseif v["licznik"] == "pom" then
kolorl "Licznik (#ff6000█#ffffff),"
elseif v["licznik"] == "fiolet" then
kolorl "Licznik (#8a00ff█#ffffff),"
elseif v["licznik"] == "zielone" then
kolorl "Licznik (#03a700█#ffffff),"
else
kolorl ""
end
if v["tempomat"] == 1 then
temp "Tempomat,"
else
temp ""
end
if v["cb"] == 1 then
cb "cb,"
else
cb ""
end
dodatki string.format(""..gaz..""..kolorl..""..temp..""..cb..""..mk1.."")
addEventHandler("onClientRender",root,renderInfo)
end
end)

function renderInfo()
dxDrawText("Przebieg: "..mileage.."km\nPojemno??: "..pojemnosc.."cm³\nTyp Paliwa: "..rodzaj.."\nPojemno?? baku: "..bak.." litr?w\nDodatki: "..dodatki..""screenW 0.7892screenH 0.3532screenW 0.9422screenH 0.4875tocolor(255255255255), 1.44"default-bold""center""center"truetruetruetruetrue)
end




addEventHandler("onClientMarkerHit"marker, function(el,md)
    if el~=localPlayer then return end
    if isPedInVehicle(elthen return end
    if guiGetVisible(wm.gridlist) == false then
                if panel == false then
                  addEventHandler("onClientRender",root,PrzechoGUI)
                  czas getTickCount()
        panel true
        showCursor(true)
        guiSetVisible(wm.gridlist,true)
        triggerServerEvent("onParkingGetRekords"localPlayer)
        --etCameraMatrix(-2056.26468.7738.49, -2048.08467.7335.17)
    end
       end
end)

local nazwy_pojazdow = {
    [527] = {nazwa="Honda NSX"},
}

function getVehicleCustomName(model)
    local nazwa ""
    if (nazwy_pojazdow[model]) then
        nazwa nazwy_pojazdow[model].nazwa
    else
        nazwa getVehicleNameFromModel(model)
    end
    return name
end

addEventHandler("onClientClick",root,function(button,state)
if panel and button == "left" and state == "down" then
     local selectedRow=guiGridListGetSelectedItem(wm.gridlist) or -1
     if selectedRow 0 then return end
     local id=guiGridListGetItemText(wm.gridlistselectedRow1)
     triggerServerEvent("getInfoFromID",localPlayer,tonumber(id))
    removeEventHandler("onClientRender",root,renderInfo)
end
end)


function Przechowyjmij(buttonstate)
if panel and button == "left" and state == "down" then
           if cursorPosition(screenW 0.3367screenH 0.6719screenW 0.1054screenH 0.0600then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist) or -1
        if selectedRow 0 then return end
        
                        local vehicles=getElementsWithinColShape(sphere,"vehicle")
        if #vehicles > 0 then
                                                 outputChatBox("* Nie ma miejsca aby wyciagnac pojazd!"25500)
            return
        end
        local id=guiGridListGetItemText(wm.gridlistselectedRow1)
        guiGridListRemoveRow(wm.gridlistselectedRow)
        triggerServerEvent("onParkingVehicleSpawn"localPlayertonumber(id))
    end
   end
end
addEventHandler("onClientClick"getRootElement(), Przechowyjmij)

function Zamknij(buttonstate)
    if panel and button == "left" and state == "down" then
           if cursorPosition(screenW 0.5688screenH 0.6719screenW 0.1054screenH 0.0600then
                panel false 
                removeEventHandler ("onClientRender"rootPrzechoGUI)
                showCursor(false)
                guiSetVisible(wm.gridlistfalse)
                 setTimer(function()
                removeEventHandler("onClientRender",root,renderInfo)
                end,300,1)
         end
    end
end

local pojazdy = {["Banshee"] = "AMG", ["Infernus"] = "Honda"}

addEventHandler("onClientClick"getRootElement(), Zamknij)

function cursorPosition(xywh)
    if (not isCursorShowing()) then
        return false
    end
    local mxmy getCursorPosition()
    local fullxfully guiGetScreenSize()
    cursorxcursory mx*fullxmy*fully
    if cursorx and cursorx and cursory and cursory h then
        return true
    else
        return false
    end
end



Kod od strony serwera

createBlip(1666.57, -1362.2617.4435,2,0,0,0,0,0,250)
local mdestroy createMarker(1666.57, -1362.2617.44"cylinder"415350204)
exports.ps_markers:createCustomMarker(mdestroy"shoes")


addEvent("onParkingGetRekords"true)
addEventHandler("onParkingGetRekords"root, function()
    local uid=getElementData(source,"player:uid")
    if not uid then return end
    local org getElementData(source,"player:organization")
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1",uid,org or "Brak")
    if #result > 0 then
        triggerClientEvent(source"onParkingGetVehicles"sourceresult)
    end
end)

local vehCustomNames = {
    [527] = 'Jaguar F TYPE',
}

addEvent("getInfoFromID",true)
addEventHandler("getInfoFromID",root,function(id)
local q exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=?",id)
triggerClientEvent(source,"setInfoFromID",source,q)
end)

addEventHandler("onMarkerHit"mdestroy, function(el,md)
    if getElementType(el) == "player" then
        local veh=getPedOccupiedVehicle(el)
        if not veh then return end
        if getVehicleController(veh) ~= el then return end
        local id=getElementData(veh,"vehicle:id")
        if not id then return end
        if isTimer(timeroddaniathen return end
        setElementFrozen(veh,true)
        outputChatBox("* Trwa oddawanie  pojazdu do przechowalni..."el,255,255,255,true)
        toggleControl(el,"enter_exit",false)
        timeroddania=setTimer(function()
            setElementFrozen(veh,false)
            local id=getElementData(veh,"vehicle:id")
            if not id then return end
            exports["ogrpg-vehicles"]:onSaveVehicle(veh)
            destroyElement(veh)
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1 WHERE id=?"id)
            toggleControl(el,"enter_exit",true)
            outputChatBox("* Pomy?lnie zapisano pojazd."el255255 ,255 ,true)
        end30001)
    elseif getElementType(el) == "vehicle" then
        local pedsgetVehicleOccupants(el)
        if #peds > 0 then return end
        local id=getElementData(el,"vehicle:id")
        if not id then return end
        if isTimer(timeroddaniathen return end
        timeroddania=setTimer(function()
            setElementFrozen(el,false)
            local id=getElementData(el,"vehicle:id")
            if not id then return end
            exports["ogrpg-vehicles"]:onSaveVehicle(el)
            destroyElement(el)
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1 WHERE id=?"id)
        end30001)
        setElementFrozen(el,true)
        setVehicleLocked(el,true)
    end
end)

local pojazdy = {["Banshee"] = "AMG", ["Infernus"] = "Honda"}

addEvent("onParkingVehicleSpawn"true)
addEventHandler("onParkingVehicleSpawn"root, function(id)
    if not id then return end
    local spawn=exports["ogrpg-vehicles"]:onRespawnVehicles(_,id,{1675.48, -1362.2317.44, -0.000.000})
       outputChatBox("* Pomy?lnie przywr?cono pojazd."source255255 ,255 ,true)
    if spawn then
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-28, 14:17


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Funkcje, kt?ra Ci zmienia nazwy to getVehicleCustomName. Nigdzie jej nie wykonujesz wi?c nie ma co sie dziwi?, ?e nie dzia?a. W pierwszy evencie ustawiasz nazw? eventu, w drugiej kolumnie listy przechowalni. Tam musisz to wstawi?. Je?li nie ma auta w tabeli nazwy_pojazdow to nazwa pozostanie oryginalna.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-28, 14:28


daybreakx3







Wiek: 27
Na forum: 2413 dni
Posty: 11
Nick w MP: Daybreak

Piwa: 2

Respekt: 50

Wilq, M?g? by? jako? pomoc to napisa? i zrobi? funkcje? bardzo bym by? wdzi?czny... bo widz? to na wielu serwerach a ja robi?c sw?j autorski serwer tego nie potrafi? zrobi?... masakra jaka?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-28, 15:07


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Autorski? S?owo ogrpg chyba znik?d si? nie wzi??o.
Nie musisz zadnej funkcji wpisa?, ty masz WYKONA? funkcje, kt?ra ju? masz. Jej nazw? przecie? napisa?em wy?ej. Jedno s?owo dajesz i zamykasz nawiasami, tylko to jednak si? wysil.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-28, 23:11


daybreakx3







Wiek: 27
Na forum: 2413 dni
Posty: 11
Nick w MP: Daybreak

Piwa: 2

Respekt: 50

Wilq, Wi?kszo?? rzeczy jest Autorskich nie wiedzia?em ?e mamy Podstaw? z OGRPG, i tak w ogol? m?g? by? troch? ja?niej jakie to ma by? s?owo i w kt?rym miejscu dane z tym nawiasem..? bardzo bym by? wdzi?czny i nawet bym ci zap?aci? za pomoc je?li chcia?by?...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-30, 20:18


KucharSolo







Wiek: 35
Na forum: 3438 dni
Posty: 94
Nick w MP: Kuchar

Piwa: 2

Respekt: 31

?? ??????

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-30, 20:48


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No ja tego bardziej nie wyt?umacz?, odpu?? sobie serwer i rozpocznij nauk? od podstaw a nie od stawiania pseudola.
Wykonanie GOTOWEJ funkcji (kt?r? ju? masz, jeszcze raz napisz?) nie powinno sprawi? problem?w, a jednak.

triggerClientEvent, outputChatBox, wszystko to s? funkcj?, kt?re wykonujesz. Przyjrzyj si? temu co masz w kodzie, wyci?gnij jakie? wnioski.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Eitho
Tagi: zmiana :: nazwy :: pojazdu :: salonie :: oraz :: przecho
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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