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

Wysłany: 2016-10-29, 00:19


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

ogrpg-vehicles limit pojazd?w
jak zrobi?

createBlip(-69.37,-1585.97,2.62, 55,2,0,0,0,0,0,275)
createBlip(1355.38, -1753.57, 13.03, 55,2,0,0,0,0,0,275)
createBlip(1996.38, -1274.57, 13.03, 55,2,0,0,0,0,0,275)
createBlip(-1957.05,306.31,35.07, 55,2,0,0,0,0,0,275)
createBlip(1999.03,-2249.19,13.94, 5,2,0,0,0,0,0,275)
createBlip(-883.05,1519.60,25.32, 55,2,0,0,0,0,0,275)

local positionVehicles = {
    -- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzeda?
    -- Salon Zwykly i luksus
    -- CYGAN
      {'Moonbeam', 418, 73222, 3250, -50.09, -1566.53, 2.71, 0.10, 359.92, 116.78},
      {'Walton', 478, 72479, 1830, -96.81, -1583.95, 2.61, 359.19, 359.99, 269.49},
      {'Sadler', 543, 74532, 4780, -81.35, -1554.69, 2.42, 358.96, 359.98, 199.54},
      {'Perennial', 404, 71732, 2500, -73.48, -1593.14, 2.35, 359.74, 359.99, 268.79},
      {'Manana', 410, 72479, 2550, -59.72, -1552.25, 2.27, 359.45, 0.00, 176.23},
      {'Buffalo', 402, 0, 58550, 1489.13, -1578.20, 14.23, 342.32, 351.45, 335.94},
      {'Premier', 426, 0, 35000, 1444.38, -1577.77, 14.23, 342.71, 9.17, 350.90},
      {'Premier', 426, 0, 35000, 1359.38, -1753.57, 13.03, 0, 0, 0},
      {'Elegy', 562, 0, 68000, 1355.38, -1753.57, 13.03, 0, 0, 0},
      {'Bullet', 541, 0, 100000, 1351.38, -1753.57, 13.03, 0, 0, 0},
      {'Fortune', 526, 0, 18000, 1347.38, -1753.57, 13.03, 0, 0, 0},
      {'Majestic', 517, 0, 18000, 1343.38, -1753.57, 13.03, 0, 0, 0},
      {'Sultan', 560, 0, 95000, 1996.38, -1274.57, 23.43, 0, 0, 180},
      {'Sanchez', 468, 0, 45000, -1955.05,306.31,35.07, 0, 0, 180},
      {'FCR 900', 521, 0, 40000, -1957.05,306.31,35.07, 0, 0, 180},
      {'NRG 500', 522, 0, 55000, -1961.05,306.31,35.07, 0, 0, 180},
      {'PCJ 600', 461, 0, 65000, -1959.05,306.31,35.07, 0, 0, 180},
      {'BMW I8', 527, 0, 480000, -1945.13,275.62,40.75, 0, 0, 90},
      {'BMW E60', 516, 0, 400000, -1945.13,271.62,40.78, 0, 0, 90},
      {'Tesla S', 507, 0, 375000, -1945.13,267.62,40.78, 0, 0, 90},
      {'Inferus', 411, 0, 350000, -1945.13,263.62,40.78, 0, 0, 90},
      {'Turismo', 451, 0, 300000, -1945.13,259.62,40.68, 0, 0, 90},
      {'Super GT', 506, 0, 95000, -1945.13,255.62,40.68, 0, 0, 90},
      {'Buffalo', 402, 0, 65000, -1945.13,275.62,35.15, 0, 0, 90},
      {'Blista', 496, 0, 55000, -1945.13,271.62,35.15, 0, 0, 90},
      {'Clover', 542, 0, 24000, -1945.13,267.62,35.15, 0, 0, 90},
      {'Flash', 565, 0, 31000, -1945.13,263.62,35.15, 0, 0, 90},
      {'Sultan', 560, 0, 150000, -1945.13,259.62,35.15, 0, 0, 90},
      {'Mesa', 500, 0, 55000, -1945.13,255.62,35.15, 0, 0, 90},
      {'Dodo', 593, 0, 1000000, 1999.03,-2249.19,13.94, 0, 0, 90},
      {'Shamal', 519, 0, 3500000, 1994.00,-2316.18,14.40, 0, 0, 90},
      {'Banshee', 429, 45467, 200000, -904.46,1547.95,25.41, 0, 0, -90},
      {'Jester', 559, 15643, 175000, -883.05,1519.60,25.51, 0, 0, 90},
      {'Cheetah', 415, 15643, 255000, -884.19,1557.24,25.56, 0, 0, 90},
}


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,'vehicle:desc','Pojazd: '..v[1]..'\nCena: '..v[4]..' PLN\nPrzebieg: '..v[3]..' km\nAby Kupi? pojazd wsi?dz na F i wpisz /kuppojazd')
    setVehicleOverrideLights(veh, 1)
    setElementFrozen(veh,true)
    setVehicleColor(veh, 22,0,0)
    --setVehiclePlateText(veh,Kupmnie)
    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 /kuppojazd')
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('kuppojazd', 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: 2016-10-29, 00:33


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

jak doda? ?eby by?o max 4 pojazdy.
czyli jak gracz ma 4 skrypt blokuje zakup 5

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-29, 00:57


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8


Więcej informacji znajdziesz w Wikipedii MTA:

getAccountData


Więcej informacji znajdziesz w Wikipedii MTA:

setAccountData


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-29, 11:28


_Wicek_

Majstersztyk






Wiek: 26
Na forum: 4401 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1842

Respekt: 360,5
Respekt: 360,5Respekt: 360,5Respekt: 360,5Respekt: 360,5

Ostrzeżeń: 40%
marcin778, Marcin...

Widzisz ?e system jest napisany pod mysql to po kiego grzyba te funkcje ?!?

A co do kodu to masz ;

createBlip(-69.37,-1585.97,2.62, 55,2,0,0,0,0,0,275)
createBlip(1355.38, -1753.57, 13.03, 55,2,0,0,0,0,0,275)
createBlip(1996.38, -1274.57, 13.03, 55,2,0,0,0,0,0,275)
createBlip(-1957.05,306.31,35.07, 55,2,0,0,0,0,0,275)
createBlip(1999.03,-2249.19,13.94, 5,2,0,0,0,0,0,275)
createBlip(-883.05,1519.60,25.32, 55,2,0,0,0,0,0,275)

local limit_aut = 5 ---------- tutaj wpisujesz maksymalna ilosc posiadanych pojazdow

local positionVehicles = {
    -- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzeda?
    -- Salon Zwykly i luksus
    -- CYGAN
      {'Moonbeam', 418, 73222, 3250, -50.09, -1566.53, 2.71, 0.10, 359.92, 116.78},
      {'Walton', 478, 72479, 1830, -96.81, -1583.95, 2.61, 359.19, 359.99, 269.49},
      {'Sadler', 543, 74532, 4780, -81.35, -1554.69, 2.42, 358.96, 359.98, 199.54},
      {'Perennial', 404, 71732, 2500, -73.48, -1593.14, 2.35, 359.74, 359.99, 268.79},
      {'Manana', 410, 72479, 2550, -59.72, -1552.25, 2.27, 359.45, 0.00, 176.23},
      {'Buffalo', 402, 0, 58550, 1489.13, -1578.20, 14.23, 342.32, 351.45, 335.94},
      {'Premier', 426, 0, 35000, 1444.38, -1577.77, 14.23, 342.71, 9.17, 350.90},
      {'Premier', 426, 0, 35000, 1359.38, -1753.57, 13.03, 0, 0, 0},
      {'Elegy', 562, 0, 68000, 1355.38, -1753.57, 13.03, 0, 0, 0},
      {'Bullet', 541, 0, 100000, 1351.38, -1753.57, 13.03, 0, 0, 0},
      {'Fortune', 526, 0, 18000, 1347.38, -1753.57, 13.03, 0, 0, 0},
      {'Majestic', 517, 0, 18000, 1343.38, -1753.57, 13.03, 0, 0, 0},
      {'Sultan', 560, 0, 95000, 1996.38, -1274.57, 23.43, 0, 0, 180},
      {'Sanchez', 468, 0, 45000, -1955.05,306.31,35.07, 0, 0, 180},
      {'FCR 900', 521, 0, 40000, -1957.05,306.31,35.07, 0, 0, 180},
      {'NRG 500', 522, 0, 55000, -1961.05,306.31,35.07, 0, 0, 180},
      {'PCJ 600', 461, 0, 65000, -1959.05,306.31,35.07, 0, 0, 180},
      {'BMW I8', 527, 0, 480000, -1945.13,275.62,40.75, 0, 0, 90},
      {'BMW E60', 516, 0, 400000, -1945.13,271.62,40.78, 0, 0, 90},
      {'Tesla S', 507, 0, 375000, -1945.13,267.62,40.78, 0, 0, 90},
      {'Inferus', 411, 0, 350000, -1945.13,263.62,40.78, 0, 0, 90},
      {'Turismo', 451, 0, 300000, -1945.13,259.62,40.68, 0, 0, 90},
      {'Super GT', 506, 0, 95000, -1945.13,255.62,40.68, 0, 0, 90},
      {'Buffalo', 402, 0, 65000, -1945.13,275.62,35.15, 0, 0, 90},
      {'Blista', 496, 0, 55000, -1945.13,271.62,35.15, 0, 0, 90},
      {'Clover', 542, 0, 24000, -1945.13,267.62,35.15, 0, 0, 90},
      {'Flash', 565, 0, 31000, -1945.13,263.62,35.15, 0, 0, 90},
      {'Sultan', 560, 0, 150000, -1945.13,259.62,35.15, 0, 0, 90},
      {'Mesa', 500, 0, 55000, -1945.13,255.62,35.15, 0, 0, 90},
      {'Dodo', 593, 0, 1000000, 1999.03,-2249.19,13.94, 0, 0, 90},
      {'Shamal', 519, 0, 3500000, 1994.00,-2316.18,14.40, 0, 0, 90},
      {'Banshee', 429, 45467, 200000, -904.46,1547.95,25.41, 0, 0, -90},
      {'Jester', 559, 15643, 175000, -883.05,1519.60,25.51, 0, 0, 90},
      {'Cheetah', 415, 15643, 255000, -884.19,1557.24,25.56, 0, 0, 90},
}


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,'vehicle:desc','Pojazd: '..v[1]..'\nCena: '..v[4]..' PLN\nPrzebieg: '..v[3]..' km\nAby Kupi? pojazd wsi?dz na F i wpisz /kuppojazd')
    setVehicleOverrideLights(veh, 1)
    setElementFrozen(veh,true)
    setVehicleColor(veh, 22,0,0)
    --setVehiclePlateText(veh,Kupmnie)
    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 /kuppojazd')
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('kuppojazd', 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)
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE ownedPlayer=?", getElementData(plr,"player:uid"))    
    if #result <= limit_aut then
        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")
    else
    triggerClientEvent(plr,"addNotification",root,string.format("Nie mo?esz zakupi? kolejnego pojazdu gdy? osi?gn??e? limit "..limit_aut.." pojazd?w"),"info")
end
    
end)


Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-29, 11:47


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

nadal nic nie daje mog? ile che kupi?.
dodam ze jak wyjd? i wejd? to nie moge.

Postaw piwo autorowi tego posta
 

 
Tagi: ogrpg-vehicles :: limit :: pojazdów
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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