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: 4076 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.561533.7025.8555,2,0,0,0,0,0,275)
createBlip(-2045.562259.9818.7555,2,0,0,0,0,275)
createBlip(172.01,-1360.29,69.30252,0,0,0,0,275)

           




local positionVehicles = {
      {'Jester'559math.random(100,2500), 1940002122.20, -2097.0413.210.0359.8307.8},
      {'Blista Compact'496math.random(100,2500), 750002121.67, -2078.0513.260.10.0217.0},
      {'Club'589math.random(100,2500), 860002111.35, -2095.3313.21360.00.0300.4},
      {'Turismo'451math.random(100,2500), 350000, -2053.682243.0019.39340.2359.9305.6},
      {'Admiral'445math.random(100,2500), 450002089.78, -2092.4013.42359.990.00304.31},
      {'Sabre'475math.random(100,2500), 550002089.98, -2085.8313.36359.750.00298.31},
      {'Savanna'567math.random(100,2500), 1350002107.09, -2085.7613.430.50.1236.3},
      {'Tornado'576math.random(100,2500), 640002135.17, -2055.402277.7319.41340.2359.4270.9},
      {'Pony'413math.random(100,650), 1850002129.83, -2080.7713.550.50.1217.0},
      {'Huntley'579math.random(100,2500), 148000, -2036.552249.3519.44340.2359.485.6},
      {'HotringRacer'494math.random(100,2500), 2000000, -1946.06258.1941.00.090.150.3},
      {'Burrito'482math.random(100,2500), 60000, -1945.06264.1941.00.090.150.3},
      {'Windsor'555math.random(100,2500), 100000, -2036.782276.5019.39340.20.187.6},
      {'Uranus'558math.random(100,2500), 45000, -1954.06292.0641.00.090.150.3},
      {'Tahoma'566math.random(100,2500), 45000, -1953.06298.0641.00.090.150.3},
      {'Blade'536math.random(100,2500), 70000, -2043.172282.3119.45340.2359.3178.8},
      {'Hustler'545math.random(100,2500), 80000, -1944.88265.0635.460.090.150.3},
      {'BloodringBanger'504math.random(100,2500), 500000, -1945.88271.0635.460.090.150.3},
      {'Mesa'500math.random(100,2500), 50000, -1961.09256.9935.47},
      {'Hotknife'434math.random(100,2500), 110000, -1954.09256.9935.47},
      {'Yosemite'554math.random(100,2500), 85000, -2055.742262.2719.52340.2359.4271.8},
      {'Glendale'466math.random(100,2500), 20000, -1961.09282.9935.47},
      {'Alpha'602math.random(100,2500), 34000, -2036.032261.6419.48340.2359.986.9},
      --Cygan
      {'Sadler'543math.random(45000,75000), 3100, -906.041550.4625.69358.8360.0305.3},
      {'Manana'410math.random(45000,75000), 2450, -906.241554.9025.66359.1359.7230.9},
      {'Moonbeam'418math.random(45000,75000), 1250, -903.991535.5525.73359.00.0277.2},
      {'Vincent'540math.random(45000,75000), 4200, -882.171521.7625.74359.00.0129.1},
      {'Perennial'404math.random(45000,75000), 900, -883.441518.3025.74359.00.044.1},
      --Motory
      {'Sanchez'468math.random(100,750), 85000961.57,-1725.53,13.200.50.190.3},
      {'PCJ-600'461math.random(100,2500), 90000963.47,-1736.80,13.200.50.190.3},
      {"Stalion"439math.random(100,250), 85000945.60,-1734.32,13.200.50.1270.3},
      {"Freeway"463math.random(100,2500), 87000946.43,-1724.93,13.200.50.1270.3},
      {"Bullet"541math.random(100,650), 500000946.83,-1711.61,13.200.50.1270.3},
      {"Cheetah"415math.random(100,650), 250000, -2055.802277.8119.46340.7359.6271.5},
      {"Infernus"411math.random(50,350), 1250000956.62, -1691.2413.310.50.1125.3},
      {"Elegy"562math.random(100,650), 200000957.04, -1698.1013.310.50.1125.3},
      {"Banshee"429math.random(100,650), 250000956.19, -1703.6813.310.50.1100.3},
      {"Flash"565math.random(100,800), 120000956.68, -1708.1713.310.50.1100.3},
          {"Sultan"560math.random(100,650), 203100946.85, -1719.3813.310.50.1270.3},
          {"Zr-350"477math.random(100,650), 173000962.72, -1731.1513.310.50.190.3},
       {"Comet"480math.random(100,650), 198700946.03, -1740.6213.310.50.1270.3},
           {"FCR-900"521math.random(100,650), 156000955.41, -1714.1613.310.50.1125.3},
            {"Limuzyna"409math.random(100,450), 1350000952.38, -1739.2313.430.50.10.0},
             {"Turismo"451math.random(100,500), 1000000962.56, -1741.1813.210.50.190.3},
             -- {"Porshe"503math.random(100,250), 4000000952.04, -1727.4013.150.50.115.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(veh1)
    setElementFrozen(veh,true) 
    setVehicleColor(veh,254,90,0)
    setVehiclePlateText(veh,"SALON")
    setVehicleDamageProof(vehtrue)
    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(plrseatjacked)
    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.'25500)
        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(plrseatjacked)
    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(plrcmd)
    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(plrcost)
    if mileage <= 10000 then
    exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)"modelgetElementData(plr,"player:uid"),mileage,"false")
    else
    exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)"modelgetElementData(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: 22
Na forum: 3865 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

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: 25
Na forum: 3588 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

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(01000)

local stan nil

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

outputChatBox("Zwrot: ".. stanelement)


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 » Prob.lem z salonem ogrpg 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