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

Wysłany: 2018-04-19, 19:09


Rumper

Majster od pysa






Wiek: 15
Na forum: 3315 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Witam,posiadam skrypt na salon z ogrpg i czy by m?g? kto? mi pom?c w tym ?e auta sie obracaj?? Chodzi mi o to ?eby sie same ca?y czas obraca?y
Za pomoc daje :piwo: i respekt
KOD:
createBlip(2100.49,-2092.77,13.5555,2,0,0,0,0,0,275)
createBlip(-67.75,-1574.73,2.6237,2,0,0,0,0,0,275)
createBlip(956.35,-1718.17,13.08552,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},
      {'Buffalo'402math.random(100,2500), 1100002138.99, -2079.0113.38360.0360.0132.0},
      {'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, -2093.6513.210.50.140},
      {'Pony'413math.random(100,650), 1850002129.83, -2080.7713.550.50.1217.0},
      {'Huntley'579math.random(100,2500), 1480002100.26, -2085.2713.550.50.1236.3},
      {'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, -1945.06270.1941.00.090.150.3},
      {'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, -1945.30259.0635.460.090.150.3},
      {'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, -1961.09271.9935.47},
      {'Glendale'466math.random(100,2500), 20000, -1961.09282.9935.47},
      {'Alpha'602math.random(100,2500), 34000, -1959.43305.8035.47},
      --Cygan
      {'Sadler'543math.random(45000,75000), 3100, -59.64, -1552.172.43358.830.21165.01},
      {'Manana'410math.random(45000,75000), 2450, -84.11, -1596.662.26359.39359.75339.31},
      {'Moonbeam'418math.random(45000,75000), 1250, -98.06, -1584.342.740.030.00323.41},
      {'Vincent'540math.random(45000,75000), 4200, -83.53, -1554.452.470.46359.20213.46},
      {'Perennial'404math.random(45000,75000), 900, -53.17, -1562.762.35359.74359.90159.48},
      {'SuperGT'506math.random(45000,75000), 1500002129.74, -2095.4513.210.50.140},
      --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), 250000946.66, -1691.2013.310.50.1255.3},
      {"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]..' PLN\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


Podpis
Elo benc
Ostatnio zmieniony przez Rumper 2018-04-19, 19:54, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-19, 19:30


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

wsi?d? do pojazdu i wpisz /gp

w konsoli "F8" ukarze si? pozycja gracz i pozycja auta. Skopiuj pozycj? auta i zmien kordy 3 ostatnich.

3 ostatnie kordy czyli
0.0, 359.8, 307.8}, odpowiada za rotacje pojazdu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-19, 19:51


Rumper

Majster od pysa






Wiek: 15
Na forum: 3315 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
A na co mam zmieni? te 3 ostanie?

Podpis
Elo benc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-19, 20:15


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Lolelo, czy chcesz uzyska? efekt obracaj?cych si? pojazd?w w salonie, jak to by?o za dawnych czas?w serwera Own World?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-19, 20:19


Atroth







Wiek: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

Respekt: 540
Respekt: 540

Obracany pojazd mo?na zrobi? na kilka sposob?w:

1. eventHandler "onClientRender" - co nie jest zbytnio dobr? opcj? dla optymalizacji :P
2. timer

Tworzysz zmienn? np. "rot = 0" wybran? dla odpowiedniej rotacji i podstawiasz j? pod createVehicle. W eventHandlerze lub w timerze ustawiasz ?eby co jaki? czas ( w przypadku timera ) dodawa?o jak?? liczb? do rot m?wi?c po prostemu.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-19, 22:12


Pevo

Jabłko






Wiek: 23
Na forum: 3589 dni
Posty: 356
Nick w MP: Pevo

Piwa: 1571

Respekt: 355,8
Respekt: 355,8Respekt: 355,8Respekt: 355,8Respekt: 355,8

Mo?esz zrobi? co? takiego (po stronie CLIENTA):


local veh,x,y,z,x2,y2,z2

local speed -- SZYBKO?? OBRACANIA SIPOJAZDU
local render 40 -- MINIMALNA ODLEG?O?? Z JAKIEJ MAJKR?CISIPOJAZDY (DLA LEKKIEJ OPTYMALIZACJINIM MNIEJ TYM LEPIEJ)

addEventHandler("onClientRender",getRootElement(),function()
    for _,v in pairs(getElementsByType("vehicle")) do
        x,y,getElementPosition(localPlayer)
        x2,y2,z2 getElementPosition(v)
        if getDistanceBetweenPoints3D(x,y,z,x2,y2,z2) > render then return end
        veh v:getData('vehsell:info')
        if not veh then return end
        _,_,getElementRotation(v)
        setElementRotation(veh,0,0,r+speed)
    end
end)


Jednak jest to ma?o optymalne (mo?e nawet przycina? na s?abszych komputerach).

Podpis
Jabłko
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Rumper
Wysłany: 2018-04-20, 19:43


Rumper

Majster od pysa






Wiek: 15
Na forum: 3315 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Dzi?ki leci piwo i respekt

Podpis
Elo benc
Postaw piwo autorowi tego posta
 

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