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

Wysłany: 2020-12-02, 11:20


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

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

Witam, mam pytanie jak zrobi? aby mo?na by?o wpisywa? swoje nazwy aut np: Audi


Kod:

 --[[
    Komisy samochodowe
    @author value <value2k@gmail.com>
    @EditDylemaT929 :)
    Nie masz prawa u?ytego kodu bez mojej zgody
]]
createBlip(1744.79, -1258.7219.8555,2,0,0,0,0,0,275) --- sredni
createBlip(1879.61, -1858.2013.5855,2,0,0,0,0,0,275) --- sf downtown sportowy
--createBlip(1483.36, -2177.8813.5555,2,0,0,0,0,0,275) --- cygan
--createBlip(2127.682366.8510.8255,2,0,0,0,0,0,275) --- cygan
createBlip2122.82, -1130.4325.4355,2,0,0,0,0,0,275) --- MOTORKI

local vehicles = {}
local komis_shapes = {}
local slots = {
    
    {2119.39, -1132.2325.0359.5360.00model=522dmax=0dmin=0price=(80000000), gdzie="sf"}, -- Kawasaki Ninja
    --{2124.69, -1134.0825.0359.5360.00model=468dmax=0dmin=0price=(40000000), gdzie="sf"}, -- BF
    --{-41.351165.6019.12358.40.5359.3model=463dmax=0dmin=0price=(3400000), gdzie="sf"}, -- Freeway
    {2126.46, -1133.8025.0359.5360.00model=471dmax=0dmin=0price=(35000000), gdzie="sf"}, -- QuadBike
    --{2121.97, -1133.4325.0359.5360.00model=461dmax=0dmin=0price=(50000000), gdzie="sf"}, -- PCJ
    
    -- Salon LV Sportowy
    {1745.80, -1251.6719.791.00.0179.40model=439dmax=0dmin=0price=(250000000), gdzie="dohertysf2"}, -- Audis3
    {1742.38, -1266.0319.50359.5360.00model=566dmax=0dmin=0price=(140000000), gdzie="dohertysf2"}, -- Fordrs
    {1747.10, -1269.0219.620.10.0358.80model=585dmax=0dmin=0price=(170000000), gdzie="dohertysf2"}, -- AlfaRomeo
    {1741.21, -1251.4919.73359.5360.0180model=546dmax=0dmin=0,price=(220000000), gdzie="dohertysf2"}, -- bmw750i
    --{1741.21, -1251.4919.73359.5360.0180model=546dmax=0dmin=0price=(95000000), gdzie="dohertysf2"}, -- infek
    --{1502.63, -2162.5513.25140.90.0143.2model=562dmax=0dmin=0price=(15000000), gdzie="dohertysf2"}, -- elegy
    --{1500.62, -2180.9313.2560.9360.053.5model=477dmax=0dmin=0price=(35000000), gdzie="dohertysf2"}, -- ZR-350

    -- Cygan 
    {1895.63, -1850.9613.23359.5360.0135.8model=410dmax=0dmin=0price=(3000000), gdzie="cygan"}, -- Manana
    {1897.79, -1865.4913.31359.80.0125.1model=404dmax=0dmin=0price=(2800000), gdzie="cygan"}, -- Perrenial
    {1864.81, -1848.6013.46360.0360.0208.6model=405dmax=0dmin=0price=(8000000), gdzie="cygan"}, -- Sentinel
    {1896.15, -1857.6113.34359.40.0131.6model=445dmax=0dmin=0price=(4199999), gdzie="cygan"}, -- Admiral
    {1889.56, -1848.0513.35360.0360.0168.4model=543dmax=0dmin=0price=(6399999), gdzie="cygan"}, -- Sadler
    
    -- Salon LV zwykly
    {2795.95, -1567.6710.600.00.0268.9model=533dmax=0dmin=0price=(4500000000), gdzie="dohertysf"}, -- Feltzer
    --{2467.08, -1762.8213.10359.9360.00.7model=401dmax=0dmin=0price=(6000000), gdzie="dohertysf"}, -- Bravura
    --{2472.21, -1762.8013.10359.9360.0359.0model=575dmax=0dmin=0price=(8000000), gdzie="dohertysf"}, -- brodway
    --{2513.22, -1754.2213.1060.9360.052.6model=518dmax=0dmin=0price=(6700000), gdzie="dohertysf"}, -- Buccaneer
    --{2507.32, -1754.6513.1060.9360.054.3model=426dmax=0dmin=0price=(12000000), gdzie="dohertysf"}, -- Premier
    --{2500.25, -1754.8113.1060.9360.055.0model=475dmax=0dmin=0price=(850000), gdzie="dohertysf"}, -- Sabre
    --{2493.38, -1754.8213.1060.9360.049.6model=561dmax=0dmin=0price=(3500000), gdzie="dohertysf"}, -- Stratum
    --{2486.27, -1754.8113.1060.9360.050.7model=589dmax=0dmin=0price=(22000000), gdzie="dohertysf"}, -- Club -- 26000000
    --{2513.28, -1744.6413.10130.9360.0130.5model=551dmax=0dmin=0price=(10000000), gdzie="dohertysf"}, -- Merit
    --{2506.54, -1744.3713.09130.90.0137.5model=536dmax=0dmin=0price=(8500000), gdzie="dohertysf"}, -- Blade
    --{2499.56, -1744.5513.10130.90.0136.4model=507dmax=0dmin=0price=(7000000), gdzie="dohertysf"}, -- Elegant
    --{2492.37, -1744.5013.10130.90.0137.7model=474dmax=0dmin=0price=(5500000), gdzie="dohertysf"}, -- Hermes price 38000000
    --{2485.53, -1744.6213.10130.90.0135.3model=527dmax=0dmin=0price=(9000000), gdzie="dohertysf"}, -- Cadrona
    --{-1957.69273.7240.870.40.0179.8model=445dmax=0dmin=0price=(17500000), gdzie="dohertysf"}, -- stary merol

    --{56.781158.9218.44359.9360.0339.5model=602dmax=0dmin=0price=(180000000), gdzie="fortc"}, -- merol
    

        --{95.801176.8018.73359.9360.0339.5model=500dmax=0dmin=0price=(30000000), gdzie="offroad"}, -- mesa
        --{95.391169.0218.73359.9360.0339.5model=579dmax=0dmin=0price=(55000000), gdzie="offroad"}, -- huntley
        --{80.621166.1718.83270.0359.990.1model=505dmax=0dmin=0price=(40000000), gdzie="offroad"}, -- rancher
        --{87.971166.0518.44270.0359.990.1model=424dmax=0dmin=0price=(60000000), gdzie="offroad"}, -- bf injection
        --{73.521165.9018.76270.0359.990.1model=400dmax=0dmin=0price=(25000000), gdzie="offroad"}, -- land stalker
        --{47.881171.3718.75270.0359.990.1model=554dmax=0dmin=0price=(25000000), gdzie="offroad"}, -- yosemite
        --{47.841164.1918.66270.0359.990.1model=483dmax=0dmin=0price=(30000000), gdzie="offroad"}, -- camper

         --Salon sportowy SF

          --{2121.842366.7710.41, -90.00.0271.1model=526dmax=0dmin=0price=(76000000), gdzie="sport"}, -- frotune
          --{2121.672372.4510.63, -90.00.0271.8model=419dmax=0dmin=0price=(105000000), gdzie="sport"}, -- doge
          --{2121.492377.2310.14, -90.00.0270.0model=547dmax=0dmin=0price=(73000000), gdzie="sport"}, -- primo
          --{2133.372366.7610.8290.0360.089.7model=579dmax=0dmin=0price=(420000000), gdzie="sport"}, -- huntley






}

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 (plrcmd)
    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 <= 99999999) and (price moneythen
        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
        if (price <= 99999999then
       takePlayerMoney(plrprice)
        else
    local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=? LIMIT 1",getElementData(plr,"player:sid"))
    if not zap then return end
    if(zap.bank_money >= pricethen
           exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-? WHERE id=? LIMIT 1"pricegetElementData(plr"player:sid"))
else
triggerClientEvent(plr"onClientAddNotification"plr,"Nie masz tyle pieniedzy w bankomacie!""error")
return false
end
        end

    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(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 qnumid exports["pystories-db"]:dbGet("INSERT INTO pystories_vehicles SET pos=?, fuel=100, bak=100, mileage=?, ownedPlayer=?, parking=1, pojemnosc_silnika=?, rodzaj=?, color=?, model=?"posdistownerpojrodzajcolormodel)
    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].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].veh2552550255255255255690255255255)
    setVehicleHeadLightColor(vehicles[slot].veh255255255)

    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(1,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(1,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"
    elseif slots[slot].gdzie == "fortc" then -- salon fc
    vehicles[slot].rodzaj "Benzyna"
    vehicles[slot].poj math.random(4,11)
    vehicles[slot].gdzie "fortc"
    elseif slots[slot].gdzie == "offroad" then -- salon fc
    vehicles[slot].rodzaj "Benzyna"
    vehicles[slot].poj math.random(4,5)
    vehicles[slot].gdzie "offroad"
    elseif slots[slot].gdzie == "sport" then -- salon sportowy sf
    vehicles[slot].rodzaj "Benzyna"
    vehicles[slot].poj math.random(1,5)
    vehicles[slot].gdzie "sport"
    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: "..przecinek(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(playervthen return v end
    end
    return false
end

--Dodatek
function przecinek(liczba)  
  local format liczba  
  while true do      
      formatstring.gsub(format"^(-?%d+)(%d%d%d)"'%1,%2')    
      if ( k==then      
          break  
      end  
  end  
  return format
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 11:29


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110

Dopisz zmienn? "nazwa" w rozpisce pojazd?w, daj w niej nazw? pojazdu i zamiast getVehicleName u?yj tej zmiennej.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 11:39


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

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

VVirmex, zrobi?em tak:

[lua[ setElementData(vehicles[slot].veh, "vehicle:desc", "Pojazd na sprzeda?!\n\nPojazd: "..getVehicleNameFromModel(nazwa).."\nKoszt: "..przecinek(slots[slot].price).." PLN\nPrzebieg: "..vehicles[slot].mileage.." km\nPojemno?? Silnika: "..vehicles[slot].poj2.." cm3\nRodzaj paliwa: "..vehicles[slot].rodzaj.."\nPojemno?? Baku: 100 L")
[/lua]

Lecz jak mam dodane przy respie auta:

    {nazwa="Manana turbo"2795.95, -1567.6710.600.00.0268.9model=533dmax=0dmin=0price=(4500000000), gdzie="dohertysf"}, -- Feltzer


To mi wywala b??d:
Kod:

attempt to concatenate a boolean value


I nie wiem co mam ?le

Ostatnio zmieniony przez TheSebaPL 2020-12-02, 11:50, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 11:49


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

nie wiem czy dobrze, ale chyba cos tego typu


local nazwa = {

       "id auta" "nazwa auta"

}



mo?esz te? pr?bwa? z tym
https://gtao.pl/zmiana-nazwy-pojazdu-ogrpg-vt112487.htm

Ostatnio zmieniony przez xyzzzikk 2020-12-02, 11:51, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 11:50


_jvneczek







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

Piwa: 3949

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


local custom_vehicles = { -- Do rozwini?cia
    [MODELAUTA] = {name="NAZWA AUTA"},
}

function getVehicleCustomName(model)
    local name ""
    if custom_vehicles[modelthen
        name custom_vehicles[model].name
    else
        name getVehicleNameFromModel(model)
    end
    return name
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 12:01


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

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

A jak doda? tutaj:

Pojazd"..getVehicleName(vehicles[slot].veh).."
Pr?buj? na r??ne sposoby i ca?y czas b??d mi wywala.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 12:07


_jvneczek







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

Piwa: 3949

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

Pojazd"..getVehicleCustomName(vehicles[slot].veh).."


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 12:11


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

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

W tej linijce jest b??d:
[lua[ name = getVehicleNameFromModel(model)[/lua]

B??d:

Kod:

Expected number at argument 1, got vehicle


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-12-02, 12:15


_jvneczek







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

Piwa: 3949

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

"TheSebaPL" napisał/a:

W tej linijce jest b??d:
[lua[ name = getVehicleNameFromModel(model)[/lua]

B??d:

Kod:

Expected number at argument 1, got vehicle


Zastosuj to co wys?a?em.

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: 2020-12-02, 12:17


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

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

psych0., zastosowa?em.

Postaw piwo autorowi tego posta
 

 
Tagi: 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 » Salon 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