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

Wysłany: 2020-05-27, 19:19


Arbuzikk







Wiek: 27
Na forum: 2514 dni
Posty: 5



Respekt: 50

dlaczego jak zamontuje silnik 2.2 i oddam do przecho to zostaje ten co by? 1.4?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-27, 22:32


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Najwyra?niej nie masz zapisu pojemno?ci silnika po schowaniu pojazdu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-27, 22:55


PatryKK.

Emeryt LUA






Wiek: 27
Na forum: 3202 dni
Posty: 1059
Nick w MP: PatryKK.

Piwa: 2331

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

wklej kod

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-28, 13:10


Irvs







Wiek: 31
Na forum: 2821 dni
Posty: 48

Piwa: 3

Respekt: 50

Przy oddawaniu do przecho zapisz pojemno?? do odpowiedniej kolumnie w bazie.
Przy wyci?ganiu sprawdz jak? ma warto?? w bazie i przypisz do samochodu. Jak poka?esz kod to co? wymy?limy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-28, 15:11


Arbuzikk







Wiek: 27
Na forum: 2514 dni
Posty: 5



Respekt: 50

jak da? wam ten kod bo nie czaje teraz? :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-28, 17:02


TheSebaPL

Mod-team






Wiek: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

Arbuzikk, kod czyli zawarto?? plik?w wejd? w skrypt przechowywalni i podaj.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-28, 17:59


Arbuzikk







Wiek: 27
Na forum: 2514 dni
Posty: 5



Respekt: 50

chowalnie = {
{{-2533.93, -15.26, 16.43},createMarker(-2533.93, -15.26, 16.43-4, "cylinder", 5, 0,64,255, 50),setElementData(createColCuboid(-2535.86, -16.77, 15.42, 3.63, 3.49, 3.59),"przecho:chowanie:id",1),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle"},
{{217.87,24.95,2.58},createMarker(217.87,24.95,2.58-4, "cylinder", 5, 0,64,255, 50),setElementData(createColCuboid(216.02, 23.25, 1.58, 3.53, 3.29, 3.24),"przecho:chowanie:id",2),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle"},
{{-2040.31, 483.25, 35.17},createMarker(-2040.31, 483.25, 35.17-5, "cylinder", 5, 0,64,255, 50),setElementData(createColCuboid(-2043.15, 480.44, 34.17, 5.66, 5.81, 3.88),"przecho:chowanie:id",3),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle"},
}

for _,c in pairs(chowalnie) do
createBlip(c[1][1],c[1][2],c[1][3], 35,2,0,0,0,0,0,250)
local t=createElement("text")
setElementData(t,"scale",1.0)
setElementData(t,"name","Pozostawianie pojazd?w")
setElementPosition(t,c[1][1],c[1][2],c[1][3])
end

addEvent("onParkingGetRekords", true)
addEventHandler("onParkingGetRekords", root, function(id)
    local sid=getElementData(client,"player:sid")
    if not sid then return end
    local org = getElementData(client,"player:organization") or "BRAK"
    local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1",sid,org)
    if #result > 0 then
        triggerClientEvent(client, "onParkingGetVehicles", root, result,id)
    end
end)

addEventHandler("onColShapeHit", root, function(el,md)
    local id_chow = getElementData(source,"przecho:chowanie:id")
    if not id_chow then return end
    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 chowalnie[id_chow][4][getVehicleType(veh)] then
        if isTimer(timeroddania) then return end
        setElementFrozen(veh,true)
        --outputChatBox("Trwa oddawanie  pojazdu.", 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["pystories-vehicles"]:onSaveVehicle(veh)
            destroyElement(veh)
            exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1,tp_to_parking=? WHERE id=?","Schowany recznie(kierowca)", id)
            toggleControl(el,"enter_exit",true)
            outputChatBox("#06B200(✔) #FFFFFFPomy?lnie zapisano pojazd.", el, 255, 255 ,255 ,true)
        end, 3000, 1)
        end
    elseif getElementType(el) == "vehicle" then
        local gracz=getVehicleController(el)
        if gracz then return end
        local id=getElementData(el,"vehicle:id")
        if not id then return end
        if chowalnie[id_chow][4][getVehicleType(veh)] then
        if isTimer(timeroddania) then return end
        timeroddania=setTimer(function()
            setElementFrozen(el,false)
            local id=getElementData(el,"vehicle:id")
            if not id then return end
            exports["pystories-vehicles"]:onSaveVehicle(el)
            destroyElement(el)
            exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1,tp_to_parking=? WHERE id=?","Schowany recznie(bez kierowcy)", id)
            outputChatBox("#06B200(✔) #FFFFFFPomy?lnie zapisano pojazd.", el, 255, 255 ,255 ,true)
        end, 3000, 1)
        setElementFrozen(el,true)
        setVehicleLocked(el,true)
        end
    end
end)

addEvent("onParkingVehicleSpawn", true)
addEventHandler("onParkingVehicleSpawn", root, function(id,miejsce)
    if not id then return end
    if not miejsce then return end
    local spawn=exports["pystories-vehicles"]:onRespawnVehicles(_,id,miejsce)
    if spawn then
    addEventHandler("onClientRender",root,render1)
    end
end)



function render1()
dxDrawText("Zrespiono pojazd", screenW * 0.3656, screenH * 0.1553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 2.50, "pricedown", "center", "center", false, false, false, false, false)
end


function renderstop1()
removeEventHandler("onClientRender",root,render1)
end
s.lua
local screenW, screenH = guiGetScreenSize()
mojeW,mojeH = 1280, 1024
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
local sx, sy = guiGetScreenSize ()
 
 przecho = false
 
function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

local vehiclesNames = {
    ["Hotring Racer"] = "Deluxo",
    ["Hotring Racer 3"] = "Mercedes Benz c63",
}

function changeName(name)
    local changedName = vehiclesNames[name]
    if changedName then
        return changedName
    else
        return name
    end
end

przechowalnie = {
{{-2532.75, -28.59, 16.48},setElementData(createMarker(-2532.75, -28.59, 16.48-1, "cylinder", 1.2, 0,64,255, 50),"przecho:id",1),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle",createColCuboid(-2538.13, -25.60, 15.43, 6.53, 4.91, 5.17),{-2534.64, -23.20, 16.19, 0.5, 360.0, 88.8}},
{{215.87,14.59,2.57},setElementData(createMarker(215.87,14.59,2.57-1, "cylinder", 1.2, 0,64,255, 50),"przecho:id",2),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle",createColCuboid(215.88, 5.09, 1.57, 3.73, 5.68, 4.60),{219.57, 7.73, 2.30, 0.1, 0.0, 270.7}},
{{-2032.27, 466.71, 35.17},setElementData(createMarker(-2032.27, 466.71, 35.17-1, "cylinder", 1.2, 0,64,255, 50), "przecho:id",3),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle",createColCuboid(-2043.15, 480.44, 34.17, 5.66, 5.81, 3.88),{-2026.92, 470.48, 36.17, 3.63, 2.81, 270}},
}

for i,p in pairs(przechowalnie) do
local t=createElement("text")
setElementData(t,"scale",1.0)
setElementData(t,"name",("Odbi?r pojazd?w\n (%s)"):format(p[4]))
setElementPosition(t,p[1][1],p[1][2],p[1][3])

end

ID_PRZECHO_DO_JAKIEJ_WLAZLES = nil

local wm={}
wm.gridlist=guiCreateGridList(357*w, 393*h, 567*w, 218*h, false)
guiGridListAddColumn(wm.gridlist, "ID", 0.19)
guiGridListAddColumn(wm.gridlist, "Model", 0.19)
guiGridListAddColumn(wm.gridlist, "Paliwo (L)", 0.19)
guiGridListAddColumn(wm.gridlist, "Przebieg (KM)", 0.19)
guiGridListAddColumn(wm.gridlist, "Ostatni Kierowca", 0.19)
guiGridListAddColumn(wm.gridlist, "Pojemno??", 0.19)
guiSetVisible(wm.gridlist, false)
guiSetAlpha(wm.gridlist, 0.8)
guiSetFont(wm.gridlist, "default-bold-small")
--guiSetProperty(wm.gridlist, "NormalTextColour", "FFFF0000")


addEvent("onParkingGetVehicles", true)
addEventHandler("onParkingGetVehicles", root, function(result,id)
    guiGridListClear(wm.gridlist)
    if not result then return end
    for i,v in pairs(result) do
        if v["mk1"] == "false" then
        v["mk1"] = "NIE"
        else
        v["mk1"] = "TAK"
        end
        local row=guiGridListAddRow(wm.gridlist)
        if przechowalnie[id][3][getVehicleType(v["model"])] then
        guiGridListSetItemText(wm.gridlist, row, 1, v["id"], false, false)
        guiGridListSetItemText(wm.gridlist, row, 2, changeName(getVehicleNameFromModel(v["model"])), false, false)
        guiGridListSetItemText(wm.gridlist, row, 3, v["fuel"], false, false)
        guiGridListSetItemText(wm.gridlist, row, 4, v["mileage"], false, false)
        guiGridListSetItemText(wm.gridlist, row, 5, v["driver"]:gsub("#%x%x%x%x%x%x",""), false, false)
        --guiGridListSetItemColor(wm.gridlist, row, 5, 0, 122, 255 )
        end
    end
end)

addEventHandler("onClientMarkerHit", root, function(el,md)
    local id = getElementData(source,"przecho:id")
    if not id then return end
    if el~=localPlayer then return end
    if isPedInVehicle(el) then return end
    if guiGetVisible(wm.gridlist) == false then
        showCursor(true)
        guiSetVisible(wm.gridlist,true)
        if przecho == false then
        addEventHandler("onClientRender",root,gui)
        przecho = true
        triggerServerEvent("onParkingGetRekords", root,id)
        ID_PRZECHO_DO_JAKIEJ_WLAZLES = id
        --etCameraMatrix(-2056.26, 468.77, 38.49, -2048.08, 467.73, 35.17)
    end
    end
end)

addEventHandler("onClientClick", root, function(btn, state)
    if btn == "left" and state == "down" then
    if przecho == true then
    if mysz(718*w, 624*h, 210*w, 78*h) then
        if guiGetVisible(wm.gridlist) == true then
            showCursor(false)
            guiSetVisible(wm.gridlist,false)
            removeEventHandler("onClientRender",root,gui)
            przecho = false
            setCameraTarget(localPlayer, localPlayer)
        end
    end
    if przecho == true then
    if mysz(352*w, 624*h, 210*w, 78*h) then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist) or -1
        if selectedRow < 0 then return end
        local vehicles=getElementsWithinColShape(przechowalnie[ID_PRZECHO_DO_JAKIEJ_WLAZLES][5],"vehicle")
        if #vehicles > 0 then
            triggerEvent('onClientAddNotification', localPlayer, 'Miejsce jest zastawione, nie mo?esz wyci?gn??\npojazdu.', 'error')
            return
        end
        local id=guiGridListGetItemText(wm.gridlist, selectedRow, 1)
        local register=guiGridListGetItemText(wm.gridlist, selectedRow, 3)
        if register == "NIE" then
        outputChatBox("*Zarejestruj pojazd w urz?dzie! Jego ID to "..id,255,0,0)
        return end
        guiGridListRemoveRow(wm.gridlist, selectedRow)
        triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id),przechowalnie[ID_PRZECHO_DO_JAKIEJ_WLAZLES][6])
    end
    end
    end
    end
end)


function gui()
        dxDrawImage(315*w, 313*h, 650*w, 400*h, "przechowalnia-psrpg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

function render1()
dxDrawText(" Nie ma miejsca aby wyci?gn?? pojazd", screenW * 0.3656, screenH * 0.1553, screenW * 0.6273, screenH * 0.3193, tocolor(0, 122, 255, 255), 1.50, "pricedown", "center", "center", false, false, false, false, false)
end

function renderstop1()
removeEventHandler("onClientRender",root,render1)
end

c.lua

[ Dodano: 2020-05-28, 18:00 ]
TheSebaPL, no i co?

Komentarz Wilq dodany 2020-05-28, 21:41Stosuj bbcode [lua] na przyszłość
Ostatnio zmieniony przez Wilq 2020-05-28, 21:40, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: pojemnosci :: silników
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