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

Wysłany: 2017-08-22, 18:19


Galaxowy

coś próbuje






Wiek: 21
Na forum: 4218 dni
Posty: 41
Nick w MP: galaxiko95

Piwa: 223

Respekt: 61

Ostrzeżeń: 20%
Jak ustawic ?eby autami nie mo?na by?o wyjechac z salonu?


createBlip(-894.56, 1533.70, 25.85, 55,2,0,0,0,0,0,275)
createBlip(-2045.56, 2259.98, 18.75, 55,2,0,0,0,0,275)
createBlip(172.01,-1360.29,69.30, 25, 2,0,0,0,0,275)

           




local positionVehicles = {
      {'Jester', 559, math.random(100,2500), 194000, 2122.20, -2097.04, 13.21, 0.0, 359.8, 307.8},
      {'Blista Compact', 496, math.random(100,2500), 75000, 2121.67, -2078.05, 13.26, 0.1, 0.0, 217.0},
      {'Club', 589, math.random(100,2500), 86000, 2111.35, -2095.33, 13.21, 360.0, 0.0, 300.4},
      {'Turismo', 451, math.random(100,2500), 350000, -2053.68, 2243.00, 19.39, 340.2, 359.9, 305.6},
      {'Admiral', 445, math.random(100,2500), 45000, 2089.78, -2092.40, 13.42, 359.99, 0.00, 304.31},
      {'Sabre', 475, math.random(100,2500), 55000, 2089.98, -2085.83, 13.36, 359.75, 0.00, 298.31},
      {'Savanna', 567, math.random(100,2500), 135000, 2107.09, -2085.76, 13.43, 0.5, 0.1, 236.3},
      {'Tornado', 576, math.random(100,2500), 64000, 2135.17, -2055.40, 2277.73, 19.41, 340.2, 359.4, 270.9},
      {'Pony', 413, math.random(100,650), 185000, 2129.83, -2080.77, 13.55, 0.5, 0.1, 217.0},
      {'Huntley', 579, math.random(100,2500), 148000, -2036.55, 2249.35, 19.44, 340.2, 359.4, 85.6},
      {'HotringRacer', 494, math.random(100,2500), 2000000, -1946.06, 258.19, 41.0, 0.09, 0.1, 50.3},
      {'Burrito', 482, math.random(100,2500), 60000, -1945.06, 264.19, 41.0, 0.09, 0.1, 50.3},
      {'Windsor', 555, math.random(100,2500), 100000, -2036.78, 2276.50, 19.39, 340.2, 0.1, 87.6},
      {'Uranus', 558, math.random(100,2500), 45000, -1954.06, 292.06, 41.0, 0.09, 0.1, 50.3},
      {'Tahoma', 566, math.random(100,2500), 45000, -1953.06, 298.06, 41.0, 0.09, 0.1, 50.3},
      {'Blade', 536, math.random(100,2500), 70000, -2043.17, 2282.31, 19.45, 340.2, 359.3, 178.8},
      {'Hustler', 545, math.random(100,2500), 80000, -1944.88, 265.06, 35.46, 0.09, 0.1, 50.3},
      {'BloodringBanger', 504, math.random(100,2500), 500000, -1945.88, 271.06, 35.46, 0.09, 0.1, 50.3},
      {'Mesa', 500, math.random(100,2500), 50000, -1961.09, 256.99, 35.47},
      {'Hotknife', 434, math.random(100,2500), 110000, -1954.09, 256.99, 35.47},
      {'Yosemite', 554, math.random(100,2500), 85000, -2055.74, 2262.27, 19.52, 340.2, 359.4, 271.8},
      {'Glendale', 466, math.random(100,2500), 20000, -1961.09, 282.99, 35.47},
      {'Alpha', 602, math.random(100,2500), 34000, -2036.03, 2261.64, 19.48, 340.2, 359.9, 86.9},
      --Cygan
      {'Sadler', 543, math.random(45000,75000), 3100, -906.04, 1550.46, 25.69, 358.8, 360.0, 305.3},
      {'Manana', 410, math.random(45000,75000), 2450, -906.24, 1554.90, 25.66, 359.1, 359.7, 230.9},
      {'Moonbeam', 418, math.random(45000,75000), 1250, -903.99, 1535.55, 25.73, 359.0, 0.0, 277.2},
      {'Vincent', 540, math.random(45000,75000), 4200, -882.17, 1521.76, 25.74, 359.0, 0.0, 129.1},
      {'Perennial', 404, math.random(45000,75000), 900, -883.44, 1518.30, 25.74, 359.0, 0.0, 44.1},
      --Motory
      {'Sanchez', 468, math.random(100,750), 85000, 961.57,-1725.53,13.20, 0.5, 0.1, 90.3},
      {'PCJ-600', 461, math.random(100,2500), 90000, 963.47,-1736.80,13.20, 0.5, 0.1, 90.3},
      {"Stalion", 439, math.random(100,250), 85000, 945.60,-1734.32,13.20, 0.5, 0.1, 270.3},
      {"Freeway", 463, math.random(100,2500), 87000, 946.43,-1724.93,13.20, 0.5, 0.1, 270.3},
      {"Bullet", 541, math.random(100,650), 500000, 946.83,-1711.61,13.20, 0.5, 0.1, 270.3},
      {"Cheetah", 415, math.random(100,650), 250000, -2055.80, 2277.81, 19.46, 340.7, 359.6, 271.5},
      {"Infernus", 411, math.random(50,350), 1250000, 956.62, -1691.24, 13.31, 0.5, 0.1, 125.3},
      {"Elegy", 562, math.random(100,650), 200000, 957.04, -1698.10, 13.31, 0.5, 0.1, 125.3},
      {"Banshee", 429, math.random(100,650), 250000, 956.19, -1703.68, 13.31, 0.5, 0.1, 100.3},
      {"Flash", 565, math.random(100,800), 120000, 956.68, -1708.17, 13.31, 0.5, 0.1, 100.3},
          {"Sultan", 560, math.random(100,650), 203100, 946.85, -1719.38, 13.31, 0.5, 0.1, 270.3},
          {"Zr-350", 477, math.random(100,650), 173000, 962.72, -1731.15, 13.31, 0.5, 0.1, 90.3},
       {"Comet", 480, math.random(100,650), 198700, 946.03, -1740.62, 13.31, 0.5, 0.1, 270.3},
           {"FCR-900", 521, math.random(100,650), 156000, 955.41, -1714.16, 13.31, 0.5, 0.1, 125.3},
            {"Limuzyna", 409, math.random(100,450), 1350000, 952.38, -1739.23, 13.43, 0.5, 0.1, 0.0},
             {"Turismo", 451, math.random(100,500), 1000000, 962.56, -1741.18, 13.21, 0.5, 0.1, 90.3},
             -- {"Porshe", 503, math.random(100,250), 4000000, 952.04, -1727.40, 13.15, 0.5, 0.1, 15.0},
}     
for i,v in pairs(positionVehicles) do
    local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
    local fuel = math.random(50,80)
    local stan = "Dobry" and "Bardzo DOBRY"
    setElementData(veh,'vehicle:desc','Pojazd: '..v[1]..'\nCena: '..v[4]..' EUR\nPrzebieg: '..v[3]..'km\nPaliwo: '..fuel..' Litr?w\nStan: '..stan..'\nAby zakupi? pojazd wsiad? do niego i wpisz /zakup')
    setVehicleOverrideLights(veh, 1)
    setElementFrozen(veh,true) 
    setVehicleColor(veh,254,90,0)
    setVehiclePlateText(veh,"SALON")
    setVehicleDamageProof(veh, true)
    setElementData(veh,'recznySalonData', true)

    veh:setData('vehsell:info', {
        ['cost']=(v[4]),
        ['model']=v[2],
        ['mileage']=v[3],
        ['selling']=v[12]
    }, false)
end

addEventHandler('onVehicleEnter', resourceRoot, function(plr, seat, jacked)
    if seat~=0 then return end
    if source:getData('vehsell:info') and source:getData('vehsell:info').selling==1 then
        plr:outputChat('* Pojazd nie jest dost?pny w sprzeda?y.', 255, 0, 0)
        return
    end

    local data=source:getData('vehsell:info')
    if not data then return end

    plr:setData('vehsell:info', {
        ['cost']=data.cost,
        ['model']=data.model,
        ['mileage']=data.mileage,
    }, false)

   -- plr:outputChat(' Aby zakupi? ten pojazd wpisz /zakup')
end)

addEventHandler('onVehicleExit', resourceRoot, function(plr, seat, jacked)
    if seat~=0 then return end

    local data=plr:getData('vehsell:info')
    if not data then return end

    plr:removeData('vehsell:info')
end)

addCommandHandler('zakup', function(plr, cmd)
    local data=plr:getData('vehsell:info')
    if not data then return end

    if getPlayerMoney(plr) < data.cost then
        triggerClientEvent(plr,"addNotification",root,"Nie posiadasz wystarczajacej kwoty pieni?dzy!","error")
        return
    end

    local vehicle=plr:getOccupiedVehicle()
    if vehicle then
        removePedFromVehicle(vehicle)
    end

    local cost=data.cost
    local model=data.model
    local mileage=data.mileage
    local uid=getElementData(plr,'player:uid') or 0
    takePlayerMoney(plr, cost)
    if mileage <= 10000 then
    exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"false")
    else
    exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"true")
    end
    triggerClientEvent(plr,"addNotification",root,string.format("Zakupi?e? sw?j pojazd "..getVehicleNameFromModel(model)..", znajdziesz go w przechowywalni."),"info")
    
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-22, 18:53


MrMrok
[Usunięty]









Galaxowy, element odpowiadaj?cy za to jest w interakcji ona blokuje wyjazdy pojazd?w z salonu .

 

 
Wysłany: 2017-08-23, 00:09


nanKy







Wiek: 23
Na forum: 4007 dni
Posty: 498
Nick w MP: nanky

Piwa: 1775

Respekt: 239
Respekt: 239Respekt: 239

Skrypt nadaje elementdat? pojazdowi salonowemu:

    setElementData(veh,'recznySalonData', true)

tak wi?c w interakcji robisz sprawdzanie:

if not getElementData(getPedOccupiedVehicle(element),"recznySalonData") then
-- kod odpalajacy silnik
else outputChatBox("jest to pojazd z salonu") end


Chcia?bym ci zwr?ci? uwag? na t? linijk? kodu:

    local stan = "Dobry" and "Bardzo DOBRY"

Jest ona ?le wykonana, pojazd b?dzie mia? ca?y czas stan "Bardzo DOBRY"
powinna ona by? wykonana w ten spos?b lub inny:

random = math.random(1,2)
if random == 1 then stan = "Dobry" elseif random == 2 then stan = "bardzodobry" end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-23, 00:43


.RiV







Wiek: 26
Na forum: 3729 dni
Posty: 554
Nick w MP: Split

Piwa: 2598

Respekt: 597,8
Respekt: 597,8

"NankY." napisał/a:

Skrypt nadaje elementdat? pojazdowi salonowemu:

    setElementData(veh,'recznySalonData', true)

tak wi?c w interakcji robisz sprawdzanie:

if not getElementData(getPedOccupiedVehicle(element),"recznySalonData") then
-- kod odpalajacy silnik
else outputChatBox("jest to pojazd z salonu") end


Chcia?bym ci zwr?ci? uwag? na t? linijk? kodu:

    local stan = "Dobry" and "Bardzo DOBRY"

Jest ona ?le wykonana, pojazd b?dzie mia? ca?y czas stan "Bardzo DOBRY"
powinna ona by? wykonana w ten spos?b lub inny:

random = math.random(1,2)
if random == 1 then stan = "Dobry" elseif random == 2 then stan = "bardzodobry" end


Je?eli chodzi o t? linijk? losowania stanu to nie ma sensu. Zrobi?bym to ?e losuje przebieg i je?eli przebieg jest wi?kszy ni? z zakresu > 1000 wtedy pojawi si? stan "Dobry". Natomiast je?eli b?dzie mniejszy ni? z zakresu < 1000 pojawi si? stan "Bardzo Dobry".

local mileage = math.random(0, 1000)

local stan = nil

if mileage <= 1000 then
stan = "Bardzo dobry"
else
stan = "Dobry"
end

outputChatBox("Zwrot: ".. stan, element)


Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Tagi: prob.lem :: salonem :: ogrpg
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