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: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

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>
    @Edit: DylemaT929 :)
    Nie masz prawa u?y? tego kodu bez mojej zgody
]]
createBlip(1744.79, -1258.72, 19.85, 55,2,0,0,0,0,0,275) --- sredni
createBlip(1879.61, -1858.20, 13.58, 55,2,0,0,0,0,0,275) --- sf downtown sportowy
--createBlip(1483.36, -2177.88, 13.55, 55,2,0,0,0,0,0,275) --- cygan
--createBlip(2127.68, 2366.85, 10.82, 55,2,0,0,0,0,0,275) --- cygan
createBlip( 2122.82, -1130.43, 25.43, 55,2,0,0,0,0,0,275) --- MOTORKI

local vehicles = {}
local komis_shapes = {}
local slots = {
    
    {2119.39, -1132.23, 25.0, 359.5, 360.0, 0, model=522, dmax=0, dmin=0, price=(80000000), gdzie="sf"}, -- Kawasaki Ninja
    --{2124.69, -1134.08, 25.0, 359.5, 360.0, 0, model=468, dmax=0, dmin=0, price=(40000000), gdzie="sf"}, -- BF
    --{-41.35, 1165.60, 19.12, 358.4, 0.5, 359.3, model=463, dmax=0, dmin=0, price=(3400000), gdzie="sf"}, -- Freeway
    {2126.46, -1133.80, 25.0, 359.5, 360.0, 0, model=471, dmax=0, dmin=0, price=(35000000), gdzie="sf"}, -- QuadBike
    --{2121.97, -1133.43, 25.0, 359.5, 360.0, 0, model=461, dmax=0, dmin=0, price=(50000000), gdzie="sf"}, -- PCJ
    
    -- Salon LV Sportowy
    {1745.80, -1251.67, 19.79, 1.0, 0.0, 179.4, 0, model=439, dmax=0, dmin=0, price=(250000000), gdzie="dohertysf2"}, -- Audis3
    {1742.38, -1266.03, 19.50, 359.5, 360.0, 0, model=566, dmax=0, dmin=0, price=(140000000), gdzie="dohertysf2"}, -- Fordrs
    {1747.10, -1269.02, 19.62, 0.1, 0.0, 358.8, 0, model=585, dmax=0, dmin=0, price=(170000000), gdzie="dohertysf2"}, -- AlfaRomeo
    {1741.21, -1251.49, 19.73, 359.5, 360.0, 180, model=546, dmax=0, dmin=0,price=(220000000), gdzie="dohertysf2"}, -- bmw750i
    --{1741.21, -1251.49, 19.73, 359.5, 360.0, 180, model=546, dmax=0, dmin=0, price=(95000000), gdzie="dohertysf2"}, -- infek
    --{1502.63, -2162.55, 13.25, 140.9, 0.0, 143.2, model=562, dmax=0, dmin=0, price=(15000000), gdzie="dohertysf2"}, -- elegy
    --{1500.62, -2180.93, 13.25, 60.9, 360.0, 53.5, model=477, dmax=0, dmin=0, price=(35000000), gdzie="dohertysf2"}, -- ZR-350

    -- Cygan 
    {1895.63, -1850.96, 13.23, 359.5, 360.0, 135.8, model=410, dmax=0, dmin=0, price=(3000000), gdzie="cygan"}, -- Manana
    {1897.79, -1865.49, 13.31, 359.8, 0.0, 125.1, model=404, dmax=0, dmin=0, price=(2800000), gdzie="cygan"}, -- Perrenial
    {1864.81, -1848.60, 13.46, 360.0, 360.0, 208.6, model=405, dmax=0, dmin=0, price=(8000000), gdzie="cygan"}, -- Sentinel
    {1896.15, -1857.61, 13.34, 359.4, 0.0, 131.6, model=445, dmax=0, dmin=0, price=(4199999), gdzie="cygan"}, -- Admiral
    {1889.56, -1848.05, 13.35, 360.0, 360.0, 168.4, model=543, dmax=0, dmin=0, price=(6399999), gdzie="cygan"}, -- Sadler
    
    -- Salon LV zwykly
    {2795.95, -1567.67, 10.60, 0.0, 0.0, 268.9, model=533, dmax=0, dmin=0, price=(4500000000), gdzie="dohertysf"}, -- Feltzer
    --{2467.08, -1762.82, 13.10, 359.9, 360.0, 0.7, model=401, dmax=0, dmin=0, price=(6000000), gdzie="dohertysf"}, -- Bravura
    --{2472.21, -1762.80, 13.10, 359.9, 360.0, 359.0, model=575, dmax=0, dmin=0, price=(8000000), gdzie="dohertysf"}, -- brodway
    --{2513.22, -1754.22, 13.10, 60.9, 360.0, 52.6, model=518, dmax=0, dmin=0, price=(6700000), gdzie="dohertysf"}, -- Buccaneer
    --{2507.32, -1754.65, 13.10, 60.9, 360.0, 54.3, model=426, dmax=0, dmin=0, price=(12000000), gdzie="dohertysf"}, -- Premier
    --{2500.25, -1754.81, 13.10, 60.9, 360.0, 55.0, model=475, dmax=0, dmin=0, price=(850000), gdzie="dohertysf"}, -- Sabre
    --{2493.38, -1754.82, 13.10, 60.9, 360.0, 49.6, model=561, dmax=0, dmin=0, price=(3500000), gdzie="dohertysf"}, -- Stratum
    --{2486.27, -1754.81, 13.10, 60.9, 360.0, 50.7, model=589, dmax=0, dmin=0, price=(22000000), gdzie="dohertysf"}, -- Club -- 26000000
    --{2513.28, -1744.64, 13.10, 130.9, 360.0, 130.5, model=551, dmax=0, dmin=0, price=(10000000), gdzie="dohertysf"}, -- Merit
    --{2506.54, -1744.37, 13.09, 130.9, 0.0, 137.5, model=536, dmax=0, dmin=0, price=(8500000), gdzie="dohertysf"}, -- Blade
    --{2499.56, -1744.55, 13.10, 130.9, 0.0, 136.4, model=507, dmax=0, dmin=0, price=(7000000), gdzie="dohertysf"}, -- Elegant
    --{2492.37, -1744.50, 13.10, 130.9, 0.0, 137.7, model=474, dmax=0, dmin=0, price=(5500000), gdzie="dohertysf"}, -- Hermes | price = 38000000
    --{2485.53, -1744.62, 13.10, 130.9, 0.0, 135.3, model=527, dmax=0, dmin=0, price=(9000000), gdzie="dohertysf"}, -- Cadrona
    --{-1957.69, 273.72, 40.87, 0.4, 0.0, 179.8, model=445, dmax=0, dmin=0, price=(17500000), gdzie="dohertysf"}, -- stary merol

    --{56.78, 1158.92, 18.44, 359.9, 360.0, 339.5, model=602, dmax=0, dmin=0, price=(180000000), gdzie="fortc"}, -- merol
    

        --{95.80, 1176.80, 18.73, 359.9, 360.0, 339.5, model=500, dmax=0, dmin=0, price=(30000000), gdzie="offroad"}, -- mesa
        --{95.39, 1169.02, 18.73, 359.9, 360.0, 339.5, model=579, dmax=0, dmin=0, price=(55000000), gdzie="offroad"}, -- huntley
        --{80.62, 1166.17, 18.83, 270.0, 359.9, 90.1, model=505, dmax=0, dmin=0, price=(40000000), gdzie="offroad"}, -- rancher
        --{87.97, 1166.05, 18.44, 270.0, 359.9, 90.1, model=424, dmax=0, dmin=0, price=(60000000), gdzie="offroad"}, -- bf injection
        --{73.52, 1165.90, 18.76, 270.0, 359.9, 90.1, model=400, dmax=0, dmin=0, price=(25000000), gdzie="offroad"}, -- land stalker
        --{47.88, 1171.37, 18.75, 270.0, 359.9, 90.1, model=554, dmax=0, dmin=0, price=(25000000), gdzie="offroad"}, -- yosemite
        --{47.84, 1164.19, 18.66, 270.0, 359.9, 90.1, model=483, dmax=0, dmin=0, price=(30000000), gdzie="offroad"}, -- camper

         --Salon sportowy SF

          --{2121.84, 2366.77, 10.41, -90.0, 0.0, 271.1, model=526, dmax=0, dmin=0, price=(76000000), gdzie="sport"}, -- frotune
          --{2121.67, 2372.45, 10.63, -90.0, 0.0, 271.8, model=419, dmax=0, dmin=0, price=(105000000), gdzie="sport"}, -- doge
          --{2121.49, 2377.23, 10.14, -90.0, 0.0, 270.0, model=547, dmax=0, dmin=0, price=(73000000), gdzie="sport"}, -- primo
          --{2133.37, 2366.76, 10.82, 90.0, 360.0, 89.7, model=579, dmax=0, dmin=0, price=(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 (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 <= 99999999) and (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
        if (price <= 99999999) then
       takePlayerMoney(plr, price)
        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 >= price) then
           exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-? WHERE id=? LIMIT 1", price, getElementData(plr, "player:sid"))
else
triggerClientEvent(plr, "onClientAddNotification", plr,"Nie masz tyle pieniedzy w bankomacie!", "error")
return false
end
        end

    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, 255, 255, 0, 255, 255, 255, 255, 69, 0, 255, 255, 255)
    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(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(player, v) then return v end
    end
    return false
end

--Dodatek
function przecinek(liczba)  
  local format = liczba  
  while true do      
      format, k = string.gsub(format, "^(-?%d+)(%d%d%d)", '%1,%2')    
      if ( k==0 ) 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: 3506 dni
Posty: 284
Nick w MP: AxyZ

Piwa: 235

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: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

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.67, 10.60, 0.0, 0.0, 268.9, model=533, dmax=0, dmin=0, price=(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: 19
Na forum: 2915 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6564

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: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

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[model] then
        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: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

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: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

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: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

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: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

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: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

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 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