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

Wysłany: 2019-02-06, 22:00


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? dopisze mi kto? linijk? by ten skrypt co 2h si? restartowa? automatycznie?
--[[
    Resource: Our-Game
    Filename: [our]vehbuy/s_vehbuy.lua
    Developers: Split <split.programista@gmail.com>
    Copyright <split.programista@gmail.com> 2015
    Nie masz prawa u?ywa? tego kodu bez mojej zgody.
]]

local positionVehicles = {
    {'Blista Compact\nsztuk 1 ', 496, math.random(0,0), math.random(3499999,3500000), -1956.11,257.54,40.67,359.6,0.0,276.2},
    {'Blista Compact\nsztuk 1 ', 496, math.random(0,0), math.random(3499998,3500000), -1955.11,305.02,40.88,360.0,360.0,95.1},
    {'\n', 560, math.random(0,0), math.random(105000,110000), -1943.89,273.41,40.75,359.9,360.0,181.7},
    {'Savanna\n', 567, math.random(0,0), math.random(50000,70000), -1943.69,256.95,40.91,0.5,360.0,16.2},
    {'Burrito\n', 482, math.random(0,0), math.random(50000,60000), -1955.91,266.65,41.17,359.1,360.0,302.5},
    {'Jester\n', 559, math.random(0,0), math.random(120000,135000), -1953.47,296.04,40.70,359.9,359.6,109.5},
    {'Jester\n', 559, math.random(0,0), math.random(120000,135000), -1945.45,262.66,35.15,0.0,0.0,86.7},
    {'Jester\n', 559, math.random(0,0), math.random(120000,135000), -1945.45,262.66,35.15,0.0,0.0,86.7},
    -- salon2
    {'ZR-350', 477, math.random(0,0), math.random(100000,120000), -1667.28,1215.85,7.01,359.8,0.0,254.1},
    {'Cheetah', 415, math.random(0,0), math.random(300000,350000), -1658.35,1214.79,13.44,0.3,0.0,213.4},
    {'Turismo', 451, math.random(0,0), math.random(700000,800000), -1647.76,1207.18,20.86,359.5,359.9,47.4},
    {'Infernus', 411, math.random(0,0), math.random(1200000,1300000), -1663.27,1222.54,20.88,0.0,0.0,189.3},
    {'Bullet', 541, math.random(0,0), math.random(800000,900000), -1671.92,1205.50,20.78,359.5,360.0,309.0},
    {'Banshee', 429, math.random(0,0), math.random(500000,550000), -1653.78,1213.42,20.84,360.0,360.0,79.5},


}

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])
    setElementData(veh,'pojazd_opis','Pojazd: '..v[1]..'\nCena: '..v[4]..' $\nPrzebieg: '..v[3]..' km\nAby kupi? pojazd wsi?d? na F i wpisz /zakup')
    setVehicleOverrideLights(veh, 1)
    setElementFrozen(veh,true)
    setVehicleColor(veh, 255, 50, 0)
    setVehicleDamageProof(veh, true)
    setElementData(veh,'vehicle.selling', 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
        outputChatBox('* Nie posiadasz wystarczaj?cej ilo?ci PLN.', plr, 255, 0, 0)
        return
    end

    local vehicle=plr:getOccupiedVehicle()
    if vehicle then
        removePedFromVehicle(vehicle)
        destroyElement(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)
    
    exports['ogrpg-db']:dbSet('INSERT INTO ogrpg_vehicles (model, frozen, ownedPlayer, parking, fuel) VALUES (?, ?, ?, ?, ?)', model, 0, getElementData(plr,'player:uid'), 1, 15)
    outputChatBox('* Zakupiles swoj pojazd! Znajdziesz go w przechowywalni', plr,255,255,255,true)
    
    Timer(function() 
        destroyElement(blip) 
    end, 60000*2, 1)
end)


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-06, 22:05


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Doklej do kodu:
setTimer(function() restartResource(getThisResource()) end, 2*60*60*1000, 0)


Upewnij si?, ?e ten skrypt ma uprawnienia Administratora w grupie ACL "Admin".

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-02-06, 22:17


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Dzi?kuj? temat do zamkni?cia

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Tagi: restart
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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