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

Wysłany: 2019-01-11, 11:34


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

Postanowi?em ulepszy? troch? salon i chcia?em go zrobi? w gui. Wszystko jest okej dop?ki nie podejd? do informacji pojazd?w. Kiedy nadaj? to informacje do gui niestety mam b??dy.


client gui

addEventHandler("onClientColShapeHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if isPedInVehicle(hitthen return end
    local veh getElementData(source"komis:slot")
    if not veh then return end
    local desc getElementData(veh"vehicle:desc")
    if not desc then return end
    addEventHandler("onClientRender"rootsalony)
    informacje_pojazdy desc
    showCursor(true)
end)



serwer

function createKomisVehicle(slot)
    if #getElementsWithinColShape(komis_shapes[slot]) > 0 then setTimer(createKomisVehicle, 250, 1, slot) return end

    vehicles[slot] = {}

    vehicles[slot].mileage math.random(slots[slot].dminslots[slot].dmax)
    vehicles[slot].price slots[slot].price

    vehicles[slot].veh createVehicle(slots[slot].modelslots[slot][1], slots[slot][2], slots[slot][3], 00slots[slot][4])
    setElementFrozen(vehicles[slot].vehtrue)
    setVehicleDamageProof(vehicles[slot].vehtrue)
    setVehicleLocked(vehicles[slot].vehtrue)

    setElementData(komis_shapes[slot], "komis:veh"vehicles[slot].veh)
    setElementData(komis_shapes[slot], "komis:slot"slot)
    setElementData(vehicles[slot].veh"komis:veh"true)
    setElementData(vehicles[slot].veh"salonowe"true)
    setVehicleOverrideLights vehicles[slot].veh)
    setVehicleColor(vehicles[slot].veh0,122,255)
    setVehicleHeadLightColor(vehicles[slot].veh255255255)

    if slots[slot].gdzie == "cygan" then
    vehicles[slot].poj math.random(1,2)
    vehicles[slot].gdzie "cygan"
    elseif slots[slot].gdzie == "zwykly" then
    vehicles[slot].poj math.random(2,3)
    vehicles[slot].gdzie "zwykly"
    elseif slots[slot].gdzie == "sportowy" then
    vehicles[slot].poj math.random(3,4)
    vehicles[slot].gdzie "sportowy"
    end

        if vehicles[slot].poj == 1 then
    vehicles[slot].poj2 1.2
    elseif vehicles[slot].poj == 2 then
    vehicles[slot].poj2 1.6
    elseif vehicles[slot].poj == 3 then
    vehicles[slot].poj2 1.8
    elseif vehicles[slot].poj == 4 then
    vehicles[slot].poj2 2.0
    elseif vehicles[slot].poj == 5 then
    vehicles[slot].poj2 2.2
    elseif vehicles[slot].poj == 6 then
    vehicles[slot].poj2 2.5
    elseif vehicles[slot].poj == 7 then
    vehicles[slot].poj2 2.6
    elseif vehicles[slot].poj == 8 then
    vehicles[slot].poj2 2.7
    elseif vehicles[slot].poj == 9 then
    vehicles[slot].poj2 2.8
    elseif vehicles[slot].poj == 10 then
    vehicles[slot].poj2 2.9
    elseif vehicles[slot].poj == 11 then
    vehicles[slot].poj2 3.0
    elseif vehicles[slot].poj == 12 then
    vehicles[slot].poj2 3.1
    local desc "Pojazd: "..getVehicleName(vehicles[slot].veh).."\nPrzebieg: "..vehicles[slot].mileage.." km\nCena: "..slots[slot].price.." PLN\nPojemno??: "..vehicles[slot].poj2.." dm³\nRodzaj paliwa: Benzyna\n Pojemno?? Baku: 50 L\nJe?eli chcesz zakupi? pojazd kliknij przycisk zakup"
    setElementData(veh"vehicle:desc"desc)
    --setElementData(vehicles[slot].veh"vehicle:desc""---------\nPojazd: "..getVehicleName(vehicles[slot].veh).."\nKoszt: "..slots[slot].price.." PLN\nPrzebieg: "..vehicles[slot].mileage.." km\nPojemno?? Silnika: "..vehicles[slot].poj2.." cm3\nRodzaj paliwa: "..vehicles[slot].rodzaj.."\nPojemno?? Baku: 100 L\nZainteresowa? ci? ten pojazd? /kuppojazd\n---------")
end





Tutaj jest problem

local desc getElementData(veh"vehicle:desc")
    if not desc then return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 12:18


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Problem jest tutaj:
setElementData(komis_shapes[slot], "komis:slot"slot)

Zapisujesz liczb? (tak wyczyta?em z kodu) a p??niej odczytujesz z tej liczby elementDat? (ju? po stronie klienta).

Zr?b co? takiego:
setElementData(komis_shapes[slot], "komis:slot"vehicles[slot].veh)

lub zapisuj opis pojazdu bezpo?rednio w elementDacie colShape.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 13:48


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

"Wilq" napisał/a:

Problem jest tutaj:
setElementData(komis_shapes[slot], "komis:slot"slot)

Zapisujesz liczb? (tak wyczyta?em z kodu) a p??niej odczytujesz z tej liczby elementDat? (ju? po stronie klienta).

Zr?b co? takiego:
setElementData(komis_shapes[slot], "komis:slot"vehicles[slot].veh)

lub zapisuj opis pojazdu bezpo?rednio w elementDacie colShape.


Zrobi?em tak. Teraz jest problem taki ?e nic si? nie pokazuje. Teraz wcale gui si? nie pokazuje


client

local screenWscreenH guiGetScreenSize()
local sxsy guiGetScreenSize()

function isMouseIn(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 informacje_pojazdy ""

function salony()
    dxDrawRectangle(screenW 0.3602screenH 0.3236screenW 0.2766screenH 0.5514tocolor(000137), false)
    --dxDrawText(informacje_pojazdyscreenW 0.3797screenH 0.3583screenW 0.6148screenH 0.8111tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
end

addEventHandler("onClientClick"root, function(btnstate)
    if btn == "left" and state == "down" then
        if isMouseIn(screenW 0.51screenH 0.68screenW 0.102screenH 0.044) and info ~= "" then
              showCursor(false)
              removeEventHandler("onClientRender"rootsalony)
              informacje_pojazdy ""
          elseif isMouseIn(screenW 0.39screenH 0.68screenW 0.102screenH 0.044) and info ~= "" then
              triggerServerEvent("kup:pojazd"localPlayer)
              showCursor(false)
              removeEventHandler("onClientRender"rootsalony)
              informacje_pojazdy ""
          end
      end
end)

addEventHandler("onClientColShapeHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if isPedInVehicle(hitthen return end
    local veh getElementData(source"komis:veh")
    if not veh then return end
    local desc getElementData(veh"vehicle:desc")
    if not desc then return end
    addEventHandler("onClientRender"rootsalony)
    informacje_pojazdy desc
    showCursor(true)
end)


serwer


--[[
    Komisy samochodowe
    @author value <value2k@gmail.com>
    @EditDylemaT929 :)
    Nie masz prawa u?ytego kodu bez mojej zgody
]]
createBlip(-930.47, -537.4226.0555,2,0,0,0,0,0,275) --- cygan
createBlip(-1663.961212.8621.1655,2,0,0,0,0,0,275) --- pojazdy sportowe
createBlip(-1950.92279.7647.7055,2,0,0,0,0,0,275) --- pojazdy zwykle

local vehicles = {}
local komis_shapes = {}
local slots = {
   
    -- Salon LV Motory
    {-1953.35306.5540.64537.40.0179.6model=521dmax=0dmin=0price=math.random(25000,26000), gdzie="motory"}, -- FCR 900
    {-1956.45306.2840.64537.40.0179.8model=581dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- BF
    {-1952.58300.2640.5989.10.091.0model=463dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- Freeway
    {-1952.72295.7940.5989.10.088.4model=471dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- QuadBike
    {-1952.91291.2840.5989.10.091.0model=461dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- PCJ


    -- Cygan 
    {-957.26, -517.7025.61310.50.0330.10model=410dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Manana
    {-936.33, -510.9625.84300.0360.0325.3model=458dmax=99343dmin=97323price=math.random(17500,18000), gdzie="cygan"}, -- Solair
    {-931.80, -496.0325.95215.2360.0194.0model=478dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Walton
    {-931.05, -538.5026.050.10.03.8model=418dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Moonbeam
    {-918.00, -533.2125.77382.0360.026.9model=543dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Sadler
    {-945.68, -531.8225.86310.50.0329.9model=540dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Vincent

    -- Salon LV Sportowy
    {-1662.961221.6513.2623000model=429dmax=0dmin=0price=math.random(65000,66000), gdzie="sportowy"}, -- Banshee
    {-1649.001207.8913.34,650.00.0model=560dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Sultan
    {-1649.991207.6020.78,650.00.0model=541dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Bullet
    {-1663.461221.5020.86,2300.00.0model=451dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Turismo
    {-1665.561206.1420.98310.8360.0306.6model=480dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Comet
    {-1673.031206.3513.38310.8360.0300.6model=506dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Super GT

    -- Salon LV zwykly
    {-1946.15257.6740.8356.00.043.5model=492dmax=0dmin=0price=math.random(65000,66000), gdzie="zwykly"}, -- Greenwood
    {-1954.08257.7040.93360.0360.0359.9model=421dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Washington
    {-1946.13273.4040.8289.10.088.9model=526dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Fortune
    {-1945.99265.4240.8289.1359.891.5model=426dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Premier
    {-1959.99304.1735.35537.4359.8180.5model=405dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Sentinel
    {-1955.37304.2135.35537.40.0179.4model=445dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Admiral
    {-1945.77273.3435.2989.1360.089.7model=550dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Sunrise
    {-1946.16268.8135.2989.1360.089.8model=436dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Previon
    {-1946.12264.1235.2989.1359.891.2+0.5model=579dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Huntley
    {-1945.96259.7835.2989.10.090.8model=475dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Sabre
    {-1953.90254.6335.2189.10.088.1model=536dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Blade
    {-1962.48258.3535.270.00.00.0model=419dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Esperanto
    {-1962.46271.8235.270.00.00.0model=602dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Alpha
    {-1962.38285.3135.270.00.00.0model=527dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Cadrona

}

addEventHandler("onResourceStart"resourceRoot, function ()
    for i,v in ipairs(slots) do
        komis_shapes[i] = createColSphere(v[1], v[2], v[3], 3)
        setElementData(komis_shapes[i], "i"i)
        createKomisVehicle(i)
    end
end)

addEvent("kup:pojazd"true)
addEventHandler("kup:pojazd"resourceRoot, function ()
local gracz source
    local shape isPlayerInVehicleColShape(gracz)
    if not shape then return end
    local veh getElementData(shape"komis:veh")
    if not veh then return end
    local slot getElementData(shape"komis:slot")

    local price vehicles[slot].price
    local money getPlayerMoney(gracz)
    if price money then
        triggerClientEvent(gracz"onClientAddNotification"gracz"* Nie sta? ci? na kupno tego pojazdu. Id? zar?b na pracach dorywczych i wr?c p??niej!"'error'255,255,255,true)    
        return
    end
    takePlayerMoney(graczprice)

    local x,y,getElementPosition(veh)
    local rx,ry,rz getElementRotation(veh)
    local i getElementInterior(veh)
    local d getElementDimension(veh)
    local pos x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..i..", "..d

    local r1,g1,b1r2,g2,b2r3,g3,b3r4,g4,b4 getVehicleColor(vehtrue)
    local color r1..", "..g1..", "..b1..", "..r2..", "..g2..", "..b2

    local owner getElementData(gracz"player:sid")
    local model getElementModel(veh)
    local dist vehicles[slot].mileage
    local poj vehicles[slot].poj
    local gdzie vehicles[slot].gdzie

    destroyElement(veh)
    setElementData(shape"komis:veh"false)
    setElementData(shape"salonowe"false)

    local qnumid exports["pystories-db"]:dbGet("INSERT INTO pystories_vehicles SET pos=?, fuel=15, mileage=?, ownedPlayer=?, parking=1, pojemnosc_silnika=?, color=?, model=?"posdistownerpojcolormodel)
    if q then
        createKomisVehicle(slot)
        triggerClientEvent(gracz"onClientAddNotification"gracz,"Gratulacje! Zakupi?e? sw?j pierwszy lub kolejny pojazd na serwerze! Pojazd zosta? przeniesiony do przechowywalni")
        setElementData(gracz"vehicle:desc"false)
        setElementData(gracz"vehicle:mileage"vehicles[slot].mileage)
        setElementData(gracz"vehicle:poj"vehicles[slot].poj2)
    else
        triggerClientEvent(gracz"onClientAddNotification"gracz"Wyst?pi? problem z kupnem pojazdu! Zg?o? to administracji serwera!"'info'255,255,255,true)    
    end
end)

function createKomisVehicle(slot)
    if #getElementsWithinColShape(komis_shapes[slot]) > 0 then setTimer(createKomisVehicle, 250, 1, slot) return end

    vehicles[slot] = {}

    vehicles[slot].mileage math.random(slots[slot].dminslots[slot].dmax)
    vehicles[slot].price slots[slot].price

    vehicles[slot].veh createVehicle(slots[slot].modelslots[slot][1], slots[slot][2], slots[slot][3], 00slots[slot][4])
    setElementFrozen(vehicles[slot].vehtrue)
    setVehicleDamageProof(vehicles[slot].vehtrue)
    setVehicleLocked(vehicles[slot].vehtrue)

    setElementData(komis_shapes[slot], "komis:veh"vehicles[slot].veh)
    setElementData(komis_shapes[slot], "komis:slot"vehicles[slot].veh)
    setElementData(vehicles[slot].veh"komis:veh"true)
    setElementData(vehicles[slot].veh"salonowe"true)
    setVehicleOverrideLights vehicles[slot].veh)
    setVehicleColor(vehicles[slot].veh0,122,255)
    setVehicleHeadLightColor(vehicles[slot].veh255255255)

    if slots[slot].gdzie == "cygan" then
    vehicles[slot].poj math.random(1,2)
    vehicles[slot].gdzie "cygan"
    elseif slots[slot].gdzie == "zwykly" then
    vehicles[slot].poj math.random(2,3)
    vehicles[slot].gdzie "zwykly"
    elseif slots[slot].gdzie == "sportowy" then
    vehicles[slot].poj math.random(3,4)
    vehicles[slot].gdzie "sportowy"
    end

        if vehicles[slot].poj == 1 then
    vehicles[slot].poj2 1.2
    elseif vehicles[slot].poj == 2 then
    vehicles[slot].poj2 1.6
    elseif vehicles[slot].poj == 3 then
    vehicles[slot].poj2 1.8
    elseif vehicles[slot].poj == 4 then
    vehicles[slot].poj2 2.0
    elseif vehicles[slot].poj == 5 then
    vehicles[slot].poj2 2.2
    elseif vehicles[slot].poj == 6 then
    vehicles[slot].poj2 2.5
    elseif vehicles[slot].poj == 7 then
    vehicles[slot].poj2 2.6
    elseif vehicles[slot].poj == 8 then
    vehicles[slot].poj2 2.7
    elseif vehicles[slot].poj == 9 then
    vehicles[slot].poj2 2.8
    elseif vehicles[slot].poj == 10 then
    vehicles[slot].poj2 2.9
    elseif vehicles[slot].poj == 11 then
    vehicles[slot].poj2 3.0
    elseif vehicles[slot].poj == 12 then
    vehicles[slot].poj2 3.1
    local desc "Pojazd: "..getVehicleName(vehicles[slot].veh).."\nPrzebieg: "..vehicles[slot].mileage.." km\nCena: "..slots[slot].price.." PLN\nPojemno??: "..vehicles[slot].poj2.." dm&#179;\nRodzaj paliwa: Benzyna\n Pojemno?? Baku: 50 L\nJe?eli chcesz zakupi? pojazd kliknij przycisk zakup"
    setElementData(veh"vehicle:desc"desc)
    --setElementData(vehicles[slot].veh"vehicle:desc""---------\nPojazd: "..getVehicleName(vehicles[slot].veh).."\nKoszt: "..slots[slot].price.." PLN\nPrzebieg: "..vehicles[slot].mileage.." km\nPojemno?? Silnika: "..vehicles[slot].poj2.." cm3\nRodzaj paliwa: "..vehicles[slot].rodzaj.."\nPojemno?? Baku: 100 L\nZainteresowa? ci? ten pojazd? /kuppojazd\n---------")
end

function isPlayerInVehicleColShape(player)
    for i,v in ipairs(komis_shapes) do
        if isElementWithinColShape(playervthen return v end
    end
    return false
end
end


Dam ca?y kod client i serwer

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 16:42


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ju? widz?, tutaj:
setElementData(veh"vehicle:desc"desc)

jest z?a zmienna pojazdu.

Chyba to, daj zna? jaki efekt po zmianie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 16:51


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

"Wilq" napisał/a:

Ju? widz?, tutaj:
setElementData(veh"vehicle:desc"desc)

jest z?a zmienna pojazdu.

Chyba to, daj zna? jaki efekt po zmianie.


Troch? nie zrozumia?em. Po stronie clienta czy serwera? i co mam z tym zrobi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 17:52


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ustawiasz elementDat? z?emu elementowi, strona server.

Tak powinno wygl?da?:
setElementData(vehicles[slot].veh"vehicle:desc"desc)


Powinno dzia?a?, je?li "vehicles[slot].veh" to poprawne wskazanie pojazdu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 18:26


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

"Wilq" napisał/a:

Ustawiasz elementDat? z?emu elementowi, strona server.

Tak powinno wygl?da?:
setElementData(vehicles[slot].veh"vehicle:desc"desc)


Powinno dzia?a?, je?li "vehicles[slot].veh" to poprawne wskazanie pojazdu.



Og?lnie ?adnego b??du nie ma i jak podchodz? do auta nie wyskakuje ?adne gui.

Teraz gdy podchodz? do auta. Jest ma?y lag jakby mia?o gui wyskoczy? a potem ju? go nie ma. W sensie nic nie wyskakuje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 20:17


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

function salony()
    dxDrawRectangle(screenW 0.3602screenH 0.3236screenW 0.2766screenH 0.5514tocolor(000137), false)
    --dxDrawText(informacje_pojazdyscreenW 0.3797screenH 0.3583screenW 0.6148screenH 0.8111tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
end


Tekst si? nie wy?wietli, jest zakomentowany.
Popraw to i wy?lij server oraz client.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-11, 21:28


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

"Wilq" napisał/a:

function salony()
    dxDrawRectangle(screenW 0.3602screenH 0.3236screenW 0.2766screenH 0.5514tocolor(000137), false)
    --dxDrawText(informacje_pojazdyscreenW 0.3797screenH 0.3583screenW 0.6148screenH 0.8111tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
end


Tekst si? nie wy?wietli, jest zakomentowany.
Popraw to i wy?lij server oraz client.


client

local screenWscreenH guiGetScreenSize()
local sxsy guiGetScreenSize()

function isMouseIn(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 informacje_pojazdy ""

function salony()
    dxDrawRectangle(screenW 0.3602screenH 0.3236screenW 0.2766screenH 0.5514tocolor(000137), false)
    dxDrawText(informacje_pojazdyscreenW 0.3797screenH 0.3583screenW 0.6148screenH 0.8111tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
end

addEventHandler("onClientClick"root, function(btnstate)
    if btn == "left" and state == "down" then
        if isMouseIn(screenW 0.51screenH 0.68screenW 0.102screenH 0.044) and info ~= "" then
              showCursor(false)
              removeEventHandler("onClientRender"rootsalony)
              informacje_pojazdy ""
          elseif isMouseIn(screenW 0.39screenH 0.68screenW 0.102screenH 0.044) and info ~= "" then
              triggerServerEvent("kup:pojazd"localPlayer)
              showCursor(false)
              removeEventHandler("onClientRender"rootsalony)
              informacje_pojazdy ""
          end
      end
end)

addEventHandler("onClientColShapeHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if isPedInVehicle(hitthen return end
    local veh getElementData(source"komis:veh")
    if not veh then return end
    local desc getElementData(veh"vehicle:desc")
    if not desc then return end
    addEventHandler("onClientRender"rootsalony)
    informacje_pojazdy desc
    showCursor(true)
end)


serwer

--[[
    Komisy samochodowe
    @author value <value2k@gmail.com>
    @EditDylemaT929 :)
    Nie masz prawa u?ytego kodu bez mojej zgody
]]
createBlip(-930.47, -537.4226.0555,2,0,0,0,0,0,275) --- cygan
createBlip(-1663.961212.8621.1655,2,0,0,0,0,0,275) --- pojazdy sportowe
createBlip(-1950.92279.7647.7055,2,0,0,0,0,0,275) --- pojazdy zwykle

local vehicles = {}
local komis_shapes = {}
local slots = {
   
    -- Salon LV Motory
    {-1953.35306.5540.64537.40.0179.6model=521dmax=0dmin=0price=math.random(25000,26000), gdzie="motory"}, -- FCR 900
    {-1956.45306.2840.64537.40.0179.8model=581dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- BF
    {-1952.58300.2640.5989.10.091.0model=463dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- Freeway
    {-1952.72295.7940.5989.10.088.4model=471dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- QuadBike
    {-1952.91291.2840.5989.10.091.0model=461dmax=0dmin=0price=math.random(20000,21000), gdzie="motory"}, -- PCJ


    -- Cygan 
    {-957.26, -517.7025.61310.50.0330.10model=410dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Manana
    {-936.33, -510.9625.84300.0360.0325.3model=458dmax=99343dmin=97323price=math.random(17500,18000), gdzie="cygan"}, -- Solair
    {-931.80, -496.0325.95215.2360.0194.0model=478dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Walton
    {-931.05, -538.5026.050.10.03.8model=418dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Moonbeam
    {-918.00, -533.2125.77382.0360.026.9model=543dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Sadler
    {-945.68, -531.8225.86310.50.0329.9model=540dmax=99343dmin=97323price=math.random(12500,13000), gdzie="cygan"}, -- Vincent

    -- Salon LV Sportowy
    {-1662.961221.6513.2623000model=429dmax=0dmin=0price=math.random(65000,66000), gdzie="sportowy"}, -- Banshee
    {-1649.001207.8913.34,650.00.0model=560dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Sultan
    {-1649.991207.6020.78,650.00.0model=541dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Bullet
    {-1663.461221.5020.86,2300.00.0model=451dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Turismo
    {-1665.561206.1420.98310.8360.0306.6model=480dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Comet
    {-1673.031206.3513.38310.8360.0300.6model=506dmax=0dmin=0price=math.random(47500,48200), gdzie="sportowy"}, -- Super GT

    -- Salon LV zwykly
    {-1946.15257.6740.8356.00.043.5model=492dmax=0dmin=0price=math.random(65000,66000), gdzie="zwykly"}, -- Greenwood
    {-1954.08257.7040.93360.0360.0359.9model=421dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Washington
    {-1946.13273.4040.8289.10.088.9model=526dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Fortune
    {-1945.99265.4240.8289.1359.891.5model=426dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Premier
    {-1959.99304.1735.35537.4359.8180.5model=405dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Sentinel
    {-1955.37304.2135.35537.40.0179.4model=445dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Admiral
    {-1945.77273.3435.2989.1360.089.7model=550dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Sunrise
    {-1946.16268.8135.2989.1360.089.8model=436dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Previon
    {-1946.12264.1235.2989.1359.891.2+0.5model=579dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Huntley
    {-1945.96259.7835.2989.10.090.8model=475dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Sabre
    {-1953.90254.6335.2189.10.088.1model=536dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Blade
    {-1962.48258.3535.270.00.00.0model=419dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Esperanto
    {-1962.46271.8235.270.00.00.0model=602dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Alpha
    {-1962.38285.3135.270.00.00.0model=527dmax=0dmin=0price=math.random(47500,48200), gdzie="zwykly"}, -- Cadrona

}

addEventHandler("onResourceStart"resourceRoot, function ()
    for i,v in ipairs(slots) do
        komis_shapes[i] = createColSphere(v[1], v[2], v[3], 3)
        setElementData(komis_shapes[i], "i"i)
        createKomisVehicle(i)
    end
end)

addEvent("kup:pojazd"true)
addEventHandler("kup:pojazd"resourceRoot, function ()
local gracz source
    local shape isPlayerInVehicleColShape(gracz)
    if not shape then return end
    local veh getElementData(shape"komis:veh")
    if not veh then return end
    local slot getElementData(shape"komis:slot")

    local price vehicles[slot].price
    local money getPlayerMoney(gracz)
    if price money then
        triggerClientEvent(gracz"onClientAddNotification"gracz"* Nie sta? ci? na kupno tego pojazdu. Id? zar?b na pracach dorywczych i wr?c p??niej!"'error'255,255,255,true)    
        return
    end
    takePlayerMoney(graczprice)

    local x,y,getElementPosition(veh)
    local rx,ry,rz getElementRotation(veh)
    local i getElementInterior(veh)
    local d getElementDimension(veh)
    local pos x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..i..", "..d

    local r1,g1,b1r2,g2,b2r3,g3,b3r4,g4,b4 getVehicleColor(vehtrue)
    local color r1..", "..g1..", "..b1..", "..r2..", "..g2..", "..b2

    local owner getElementData(gracz"player:sid")
    local model getElementModel(veh)
    local dist vehicles[slot].mileage
    local poj vehicles[slot].poj
    local gdzie vehicles[slot].gdzie

    destroyElement(veh)
    setElementData(shape"komis:veh"false)
    setElementData(shape"salonowe"false)

    local qnumid exports["pystories-db"]:dbGet("INSERT INTO pystories_vehicles SET pos=?, fuel=15, mileage=?, ownedPlayer=?, parking=1, pojemnosc_silnika=?, color=?, model=?"posdistownerpojcolormodel)
    if q then
        createKomisVehicle(slot)
        triggerClientEvent(gracz"onClientAddNotification"gracz,"Gratulacje! Zakupi?e? sw?j pierwszy lub kolejny pojazd na serwerze! Pojazd zosta? przeniesiony do przechowywalni")
        setElementData(gracz"vehicle:desc"false)
        setElementData(gracz"vehicle:mileage"vehicles[slot].mileage)
        setElementData(gracz"vehicle:poj"vehicles[slot].poj2)
    else
        triggerClientEvent(gracz"onClientAddNotification"gracz"Wyst?pi? problem z kupnem pojazdu! Zg?o? to administracji serwera!"'info'255,255,255,true)    
    end
end)

function createKomisVehicle(slot)
    if #getElementsWithinColShape(komis_shapes[slot]) > 0 then setTimer(createKomisVehicle, 250, 1, slot) return end

    vehicles[slot] = {}

    vehicles[slot].mileage math.random(slots[slot].dminslots[slot].dmax)
    vehicles[slot].price slots[slot].price

    vehicles[slot].veh createVehicle(slots[slot].modelslots[slot][1], slots[slot][2], slots[slot][3], 00slots[slot][4])
    setElementFrozen(vehicles[slot].vehtrue)
    setVehicleDamageProof(vehicles[slot].vehtrue)
    setVehicleLocked(vehicles[slot].vehtrue)

    setElementData(komis_shapes[slot], "komis:veh"vehicles[slot].veh)
    setElementData(komis_shapes[slot], "komis:slot"slot)
    setElementData(vehicles[slot].veh"komis:veh"true)
    setElementData(vehicles[slot].veh"salonowe"true)
    setVehicleOverrideLights vehicles[slot].veh)
    setVehicleColor(vehicles[slot].veh0,122,255)
    setVehicleHeadLightColor(vehicles[slot].veh255255255)

    if slots[slot].gdzie == "cygan" then
    vehicles[slot].poj math.random(1,2)
    vehicles[slot].gdzie "cygan"
    elseif slots[slot].gdzie == "zwykly" then
    vehicles[slot].poj math.random(2,3)
    vehicles[slot].gdzie "zwykly"
    elseif slots[slot].gdzie == "sportowy" then
    vehicles[slot].poj math.random(3,4)
    vehicles[slot].gdzie "sportowy"
    end

        if vehicles[slot].poj == 1 then
    vehicles[slot].poj2 1.2
    elseif vehicles[slot].poj == 2 then
    vehicles[slot].poj2 1.6
    elseif vehicles[slot].poj == 3 then
    vehicles[slot].poj2 1.8
    elseif vehicles[slot].poj == 4 then
    vehicles[slot].poj2 2.0
    elseif vehicles[slot].poj == 5 then
    vehicles[slot].poj2 2.2
    elseif vehicles[slot].poj == 6 then
    vehicles[slot].poj2 2.5
    elseif vehicles[slot].poj == 7 then
    vehicles[slot].poj2 2.6
    elseif vehicles[slot].poj == 8 then
    vehicles[slot].poj2 2.7
    elseif vehicles[slot].poj == 9 then
    vehicles[slot].poj2 2.8
    elseif vehicles[slot].poj == 10 then
    vehicles[slot].poj2 2.9
    elseif vehicles[slot].poj == 11 then
    vehicles[slot].poj2 3.0
    elseif vehicles[slot].poj == 12 then
    vehicles[slot].poj2 3.1
    local desc "Pojazd: "..getVehicleName(vehicles[slot].veh).."\nPrzebieg: "..vehicles[slot].mileage.." km\nCena: "..slots[slot].price.." PLN\nPojemno??: "..vehicles[slot].poj2.." dm&#179;\nRodzaj paliwa: Benzyna\n Pojemno?? Baku: 50 L\nJe?eli chcesz zakupi? pojazd kliknij przycisk zakup"
    setElementData(vehicles[slot].veh"vehicle:desc"desc)
    --setElementData(vehicles[slot].veh"vehicle:desc""---------\nPojazd: "..getVehicleName(vehicles[slot].veh).."\nKoszt: "..slots[slot].price.." PLN\nPrzebieg: "..vehicles[slot].mileage.." km\nPojemno?? Silnika: "..vehicles[slot].poj2.." cm3\nRodzaj paliwa: "..vehicles[slot].rodzaj.."\nPojemno?? Baku: 100 L\nZainteresowa? ci? ten pojazd? /kuppojazd\n---------")
end

function isPlayerInVehicleColShape(player)
    for i,v in ipairs(komis_shapes) do
        if isElementWithinColShape(playervthen return v end
    end
    return false
end
end


Postaw piwo autorowi tego posta
 

 
Tagi: gui :: salon
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Gui salon 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