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: 3457 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.55, 55,2,0,0,0,0,0,275)
createBlip(-67.75,-1574.73,2.62, 37,2,0,0,0,0,0,275)
createBlip(956.35,-1718.17,13.08, 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},
      {'Buffalo', 402, math.random(100,2500), 110000, 2138.99, -2079.01, 13.38, 360.0, 360.0, 132.0},
      {'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, -2093.65, 13.21, 0.5, 0.1, 40},
      {'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, 2100.26, -2085.27, 13.55, 0.5, 0.1, 236.3},
      {'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, -1945.06, 270.19, 41.0, 0.09, 0.1, 50.3},
      {'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, -1945.30, 259.06, 35.46, 0.09, 0.1, 50.3},
      {'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, -1961.09, 271.99, 35.47},
      {'Glendale', 466, math.random(100,2500), 20000, -1961.09, 282.99, 35.47},
      {'Alpha', 602, math.random(100,2500), 34000, -1959.43, 305.80, 35.47},
      --Cygan
      {'Sadler', 543, math.random(45000,75000), 3100, -59.64, -1552.17, 2.43, 358.83, 0.21, 165.01},
      {'Manana', 410, math.random(45000,75000), 2450, -84.11, -1596.66, 2.26, 359.39, 359.75, 339.31},
      {'Moonbeam', 418, math.random(45000,75000), 1250, -98.06, -1584.34, 2.74, 0.03, 0.00, 323.41},
      {'Vincent', 540, math.random(45000,75000), 4200, -83.53, -1554.45, 2.47, 0.46, 359.20, 213.46},
      {'Perennial', 404, math.random(45000,75000), 900, -53.17, -1562.76, 2.35, 359.74, 359.90, 159.48},
      {'SuperGT', 506, math.random(45000,75000), 150000, 2129.74, -2095.45, 13.21, 0.5, 0.1, 40},
      --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, 946.66, -1691.20, 13.31, 0.5, 0.1, 255.3},
      {"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]..' PLN\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) 


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: 4182 dni
Posty: 340
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: 3457 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: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

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: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

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: 24
Na forum: 3731 dni
Posty: 356
Nick w MP: Pevo

Piwa: 1578

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 = 4 -- SZYBKO?? OBRACANIA SI? POJAZDU
local render = 40 -- MINIMALNA ODLEG?O?? Z JAKIEJ MAJ? KR?CI? SI? POJAZDY (DLA LEKKIEJ OPTYMALIZACJI, NIM MNIEJ TYM LEPIEJ)

addEventHandler("onClientRender",getRootElement(),function()
    for _,v in pairs(getElementsByType("vehicle")) do
        x,y,z = 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
        _,_,r = 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: 3457 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 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