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

Wysłany: 2019-07-25, 11:54


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam mam problem z salonami z paczki PSRPG. Gdy ustawiam auta w nowym miejsu one przestawiaj? si? jak chc? a nie jak ja im daje kordy :/ a 2 powodem jest to ?e gdy daje przebieg wy?szy ni? 50k salon nie dzia?a :/

SALON.lua
--[[
    Komisy samochodowe
    @author value <value2k@gmail.com>
    @Edit: DylemaT929 :)
    Nie masz prawa u?y? tego kodu bez mojej zgody
]]
createBlip(-1959.59, 285.91, 35.47, 55,2,0,0,0,0,0,275) --- sf doherty zwykly
createBlip(-1641.25, 1203.88, 7.25, 55,2,0,0,0,0,0,275) --- sf downtown sportowy
createBlip(-1.06, 1364.94, 9.17, 55,2,0,0,0,0,0,275) --- cygan

local vehicles = {}
local komis_shapes = {}
local slots = {
--[[    
    {-1953.35, 306.55, 40.64, 537.4, 0.0, 179.6, model=521, dmax=0, dmin=0, price=(25000000), gdzie="sf"}, -- FCR 900
    {-1956.45, 306.28, 40.64, 537.4, 0.0, 179.8, model=581, dmax=0, dmin=0, price=(23000000), gdzie="sf"}, -- BF
    {-1952.58, 300.26, 40.59, 89.1, 0.0, 91.0, model=463, dmax=0, dmin=0, price=(4000000), gdzie="sf"}, -- Freeway
    {-1952.72, 295.79, 40.59, 89.1, 0.0, 88.4, model=471, dmax=0, dmin=0, price=(5000000), gdzie="sf"}, -- QuadBike
    {-1952.91, 291.28, 40.59, 89.1, 0.0, 91.0, model=461, dmax=0, dmin=0, price=(3200000), gdzie="sf"}, -- PCJ
    
    -- Salon LV Sportowy
    {-1662.96, 1221.65, 13.26, 230, 0, 0, model=415, dmax=0, dmin=0,   price=(79000000), gdzie="dohertysf2"}, -- cheetah
    {-1649.00, 1207.89, 13.34,65, 0.0, 0.0, model=404, dmax=0, dmin=0, price=(45500000), gdzie="dohertysf2"}, -- Sultan
    {-1649.99, 1207.60, 20.78,65, 0.0, 0.0, model=541, dmax=0, dmin=0, price=(83200000), gdzie="dohertysf2"}, -- hto
    {-1663.46, 1221.50, 20.86,230, 0.0, 0.0, model=451, dmax=0, dmin=0,price=(80200000), gdzie="dohertysf2"}, -- Turismo
    {-1665.56, 1206.14, 20.98, 310.8, 360.0, 306.6, model=587, dmax=0, dmin=0, price=(51000000), gdzie="dohertysf2"}, -- euros
    {-1673.03, 1206.35, 13.38, 310.8, 360.0, 300.6, model=562, dmax=0, dmin=0, price=(61500000), gdzie="dohertysf2"}, -- elegy
--]]

    -- Cygan 
    {4.65, 1347.62, 8.83, 359.4, 0.0, 329.7, model=410, dmax=40000, dmin=40000, price=(3051), gdzie="cygan"}, -- Manana
    {25.04, 1363.29, 8.91, 359.7, 360.0, 103.4, model=404, dmax=40000, dmin=40000, price=(1985), gdzie="cygan"}, -- Solair
    {-26.34, 1358.52, 9.16, 359.2, 360.0, 132.2, model=478, dmax=40000, dmin=40000, price=(1512), gdzie="cygan"}, -- Walton
    {-21.05, 1343.50, 9.27, 0.1, 0.0, 98.5, model=418, dmax=40000, dmin=40000, price=(1169), gdzie="cygan"}, -- Moonbeam
    {0.49, 1388.78, 9.00, 359.1, 360.0, 162.2, model=543, dmax=40000, dmin=40000, price=(4032), gdzie="cygan"}, -- Sadler
    {7.23, 1376.03, 9.08, 360.0, 0.0, 134.7, model=540, dmax=40000, dmin=40000, price=(8135), gdzie="cygan"}, -- Vincent
    {-16.17, 1385.11, 8.89, 359.1, 0.0, 144.4, model=600, dmax=40000, dmin=40000, price=(12314), gdzie="cygan"}, -- Picador
    
    -- Salon LV zwykly
    {-1.03, 1227.72, 19.18, 0.4, 360.0, -180, model=445, dmax=0, dmin=0, price=(35000000), gdzie="dohertysf"}, -- Admiral
    {-52.97, 1226.34, 18.99, 359.6, 360.0, 268.2, model=565, dmax=0, dmin=0, price=(25000000), gdzie="dohertysf"}, -- Bravura
    {2.23, 1227.58, 18.96, 359.7, 360.0, 180.3, model=575, dmax=0, dmin=0, price=(3700000), gdzie="dohertysf"}, -- brodway
    {5.46, 1227.80, 19.13, 359.2, 360.0, 180.6, model=518, dmax=0, dmin=0, price=(45000000), gdzie="dohertysf"}, -- Buccaneer
    --{-1959.99, 304.17, 35.35, 537.4, 359.8, 180.5, model=603, dmax=0, dmin=0, price=(41000000), gdzie="dohertysf"}, -- phoenix
    --{-1955.37, 304.21, 35.35, 537.4, 0.0, 179.4, model=580, dmax=0, dmin=0, price=(53000000), gdzie="dohertysf"}, -- stafford
    --{-1945.77, 273.34, 35.29, 89.1, 360.0, 89.7, model=561, dmax=0, dmin=0, price=(35500000), gdzie="dohertysf"}, -- Stratum
    --{-1946.16, 268.81, 35.29, 89.1, 360.0, 89.8, model=495, dmax=0, dmin=0, price=(60000000), gdzie="dohertysf"}, -- Sandking
    {-16.31, 1211.85, 19.14, 0.0, 360.0, 1.7, model=589, dmax=0, dmin=0, price=(38500000), gdzie="dohertysf"}, -- Club
    {-19.50, 1211.77, 19.15, 360.0, 0.0, 0.4, model=551, dmax=0, dmin=0, price=(47550000), gdzie="dohertysf"}, -- Merit
    --{-1953.90, 254.63, 35.21, 89.1, 0.0, 88.1, model=536, dmax=0, dmin=0, price=(43000000), gdzie="dohertysf"}, -- Blade
    {-29.49, 1211.75, 19.17, 359.7, 360.0, 359.1, model=507, dmax=0, dmin=0, price=(40000000), gdzie="dohertysf"}, -- Elegant
    {-39.37, 1211.48, 19.14, 0.0, 0.1, 0.3, model=474, dmax=0, dmin=0, price=(38000000), gdzie="dohertysf"}, -- Hermes
    {-52.17, 1216.45, 19.17, 0.0, 360.0, 269.8, model=545, dmax=0, dmin=0, price=(35000000), gdzie="dohertysf"}, -- Hustler
    {-33.09, 1226.52, 20.02, 344.8, 13.3, 189.4, model=475, dmax=0, dmin=0, price=(40000000), gdzie="dohertysf"}, -- Sabre
    {-23.52, 1226.88, 20.16, 340.6, 359.7, 179.2, model=559, dmax=0, dmin=0, price=(38000000), gdzie="dohertysf"}, -- Jester
    {-13.43, 1228.02, 20.30, 343.7, 348.3, 176.2, model=402, dmax=0, dmin=0, price=(35000000), gdzie="dohertysf"}, -- Buffalo

}

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)

        addEventHandler("onColShapeHit", komis_shapes[i], function (hit,dim)
            if getElementType(hit) == "player" and getElementData(komis_shapes[i], "komis:veh") then
                triggerClientEvent(hit, "onClientAddNotification", hit,"Zainteresowa? ci? ten pojazd? /kuppojazd", "info")
            end
        end)

    end
end)

addCommandHandler("kuppojazd", function (plr, cmd)
    local shape = isPlayerInVehicleColShape(plr)
    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(plr)
    if price > money then
        triggerClientEvent(plr, "onClientAddNotification", plr,"* Nie sta? ci? na kupno tego pojazdu. Id? zar?b na pracach dorywczych i wr?c p??niej!", "error")
        return
    end
    takePlayerMoney(plr, price)

    local x,y,z = 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,b1, r2,g2,b2, r3,g3,b3, r4,g4,b4 = getVehicleColor(veh, true)
    local color = r1..", "..g1..", "..b1..", "..r2..", "..g2..", "..b2

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

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

    local q, num, id = exports["pystories-db"]:dbGet("INSERT INTO pystories_vehicles SET pos=?, fuel=100, bak=100, mileage=?, ownedPlayer=?, parking=1, pojemnosc_silnika=?, rodzaj=?, color=?, model=?", pos, dist, owner, poj, rodzaj, color, model)
    if q then
        createKomisVehicle(slot)
        triggerClientEvent(plr, "onClientAddNotification", plr,"Gratulacje!\nZakupi?e? sw?j pierwszy lub kolejny pojazd na serwerze!\nPojazd zosta? przeniesiony do przechowywalni", "info")
        setElementData(plr, "vehicle:desc", false)
        setElementData(plr, "vehicle:mileage", vehicles[slot].mileage)
        setElementData(plr, "vehicle:rodzaj", vehicles[slot].rodzaj)
        setElementData(plr, "vehicle:poj", vehicles[slot].poj2)
    else
        triggerClientEvent(plr, "onClientAddNotification", plr," Wyst?pi? problem z kupnem pojazdu! Zg?o? to administracji serwera!", "error")
    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].dmin, slots[slot].dmax)
    vehicles[slot].price = slots[slot].price

    vehicles[slot].veh = createVehicle(slots[slot].model, slots[slot][1], slots[slot][2], slots[slot][3], 0, 0, slots[slot][4])
    setElementFrozen(vehicles[slot].veh, true)
    setVehicleDamageProof(vehicles[slot].veh, true)
    setVehicleLocked(vehicles[slot].veh, true)

    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, 2 )
    setVehicleColor(vehicles[slot].veh, 0,90,242)
    setVehicleHeadLightColor(vehicles[slot].veh, 255, 255, 255)

    if slots[slot].gdzie == "dohertysf" then --zwykly salon
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(2,3)
    vehicles[slot].gdzie = "dohertysf"
    elseif slots[slot].gdzie == "dohertysf2" then -- sportowy salon
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(3,4)
    vehicles[slot].gdzie = "dohertysf2"
    elseif slots[slot].gdzie == "cygan" then -- salon cygan
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(1,2)
    vehicles[slot].gdzie = "cygan"
    elseif slots[slot].gdzie == "sf" then -- salon motory
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(2,3)
    elseif slots[slot].gdzie == "sf" then
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(6,7)
    vehicles[slot].gdzie = "unikat"
    elseif slots[slot].gdzie == "unikat" then
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(7,8)
    vehicles[slot].gdzie = "unikat"
    elseif slots[slot].gdzie == "unikat2" then
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(9,10)
    vehicles[slot].gdzie = "unikat2"
    elseif slots[slot].gdzie == "unikat3" then
    vehicles[slot].rodzaj = "Benzyna"
    vehicles[slot].poj = math.random(11,12)
    vehicles[slot].gdzie = "unikat3"
    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
    end

    setElementData(vehicles[slot].veh, "vehicle:desc", "Pojazd na sprzeda?!\n\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")
end

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-27, 01:52


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

daj zamiast -1953.35, 306.55, 40.64, 537.4, 0.0, 179.6 to -1953.35, 306.55, 40.64, 179.6 + podaj kod b??du w db3 jak dajesz wi?cej przebiegu ni? 50k

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-27, 16:53


DylemaT929

Nikt






Wiek: 28
Na forum: 4182 dni
Posty: 340
Nick w MP: dylemat929

Piwa: 3195

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

Wyt?umacz? jak dzia?a ten salon
[lua]
{-1953.35, 306.55, 40.64, 537.4, 0.0, 179.6, model=521, dmax=0, dmin=0, price=(25000000), gdzie="sf"}, -- FCR 900p/lua]

pierwsze trzy kordy to pozycja pojazdu(x,y,z), kolejne trzy to s? rotacje pojazdu(xx, xy, xz), model(czyli szukasz infernusa, a infernus to 411 id), dmax(maksymalny przebieg), dmin(minimalny przebieg), price(czyli ile ma kosztowa? pojazd i tutaj musisz wpisa? od do czyli price={10000,50000}, gdzie(to zaznaczone pojemno?ci auta kt?re masz przepisane ni?ej). Musisz zastosowa? si? do tego co ja pisz? bo inaczej salon nie b?dzie dzia?a?. Pami?taj aby sprawdza? zawsze /debugscript 3 b??d salonu.

wpisuj?c /gp b?dziesz mia? pozycj? i rotacj? pojazdu.

Postaw piwo autorowi tego posta
 

 
Tagi: salon :: psrpg
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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