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

Wysłany: 2015-06-01, 17:02


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

Siemka, kiedy? jaki? u?ytkownik pojazdu mia? problem z prywatnymi pojazdami. Mam teraz problem, poniewa? wyskakuje mi DB, te? dam kod

function enterVehicle ( source, seat, jacked )
    local playercar = getPedOccupiedVehicle ( source )
    if(seat == 0) then
        if (getElementData ( playercar, "owner" )) then
               if(getElementData ( playercar, "owner" ) ~= "Nobody" ) then
                   if(getElementData ( playercar, "owner" ) == getAccountName(getPlayerAccount(source))) then
                       outputChatBox ("To twoj pojazd!",source, 255,255,127 )
                else
                    outputChatBox ("Ten pojazd jest wlasnoscia: "..getElementData ( playercar, "owner" ).."",source, 255,255,127 )
                end
            else
                local price = getElementData ( playercar, "price" )
                triggerClientEvent ( source, "showBuyCar", source, price)
                toggleAllControls ( source, false, true, false )
                return true
            end
        end
    end
end

addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle )

function AcceptToBuyCar ( )
    local playercar = getPedOccupiedVehicle ( source )
    if(getElementData ( playercar, "owner" ) == "Nobody") then
        if(getPlayerMoney ( source ) > tonumber(getElementData ( playercar, "price"))) then
               setElementData ( playercar, "owner", getAccountName(getPlayerAccount(source))))
            takePlayerMoney ( source, tonumber(getElementData ( playercar, "price" )))
            toggleAllControls ( source, true )
            outputChatBox ("Gratulujemy zakupu nowego pojazdu!", source, 243,149,72 )
            destroyElement(buycarpickup[getElementData(playercar,"num")])
            saveCars ()
        else
            outputChatBox ("Brak funduszy!", source, 243,149,72 )
            setControlState ( source, "enter_exit", true )
        end
    end
end
addEvent("acceptBuyCar",true)
addEventHandler("acceptBuyCar",root,AcceptToBuyCar)

function playerCarLock ( source, cmd)
    for i,v in ipairs (cars) do
        if(getElementData ( cars[i:1], "owner" ) == getAccountName(getPlayerAccount(source))) then
               setVehicleLocked ( cars[i:2], true )
            setElementData (cars[i:3],"lock", 1)
            outputChatBox ("Zamknieto twoj pojazd!",source, 243,149,72 )
              saveCars()
        end
    end
end

addCommandHandler ("zamknij",playerCarLock)


function playerCarUnLock ( source, cmd)
    for i,v in ipairs (cars) do
        if(getElementData ( cars[i:4], "owner" ) == getAccountName(getPlayerAccount(source))) then
               setVehicleLocked ( cars[i:5], false )
            setElementData (cars[i:6],"lock", 0)
            outputChatBox ("Otwarto twoj pojazd!",source, 243,149,72 )
              saveCars()
        end
    end
end

addCommandHandler ("otworz",playerCarUnLock)




My?l?, ?e pomo?ecie.

Ja tak my?l?, ?e brakuje ) lub za du?o gdzie? jest )

[ Dodano: 2015-06-01, 17:09 ]
Dobra z ten DB pozby?em si? go, by?o o 1 ) za du?o w 133 linijce ;D ale teraz mam kolejnego...

         if(getElementData ( cars[i:1], "owner" ) == getAccountName(getPlayerAccount(source))) then 

chodzi o t? linijk? 150.
Prosz? o pomoc ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-01, 17:37


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

cars[i:1]


Co to jest?

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-01, 19:03


sebik2303

Mapper :)






Wiek: 25
Na forum: 4301 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

Shuffle, ju? zobaczy?em powinno by?
 cars[i] 

Temat do zamkni?cia.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-01, 20:07


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

[clo]

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Tagi: kod :: pojazdy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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