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

Wysłany: 2013-07-24, 14:08


wwa22442







Wiek: 38
Na forum: 4706 dni
Posty: 127

Piwa: 82

Respekt: 50

Ostrzeżeń: 20%
Witajcie !

Jak zrobi? zapis tuningu i uszkodze? w tym kodzie ?


function(idcostname)
  if (getPlayerMoney (source) >= tonumber(cost)) then
    outputChatBox ("Kupiles woz " .. namesource25500false)
    outputChatBox ("ID pojazdu: " .. idsource25500false)
    outputChatBox ("Koszt: " .. costsource25500false)
    takePlayerMoney (sourcetonumber (cost))
    setAccountData (getPlayerAccount (source), "funmodev2-car"tonumber(id))
    setAccountData (getPlayerAccount (source), "funmodev2-paintjob"3)
    setAccountData (getPlayerAccount (source), "funmodev2-carupg"0)
  else
    outputChatBox ("Nie posiadasz tyle kasy!"source25500false)
  end
end)


addEvent ("carSpawn"true)
addEvent ("carDestroy"true)


function carSpawn ()
  if not (isGuestAccount (getPlayerAccount (source))) and not (isPedInVehicle(source)) then
    if (getElementData (source"hisCar")) and (getElementData (source"hisCar") ~= nil) and (getElementType(getElementData (source"hisCar")) == "vehicle"then
      setElementVelocity (getElementData (source"hisCar"), 0,0,0)
      local x,y,getElementPosition (source)
      setVehicleRotation (getElementData (source"hisCar"), 000)
      setElementPosition (getElementData (source"hisCar"), x+2,y,+1)
      outputChatBox ("Car spawned."source25500)
    elseif not (getElementData (source"hisCar")) then
      local accountData getAccountData (getPlayerAccount (source), "funmodev2-car")
      if (accountDatathen
        carID getAccountData (getPlayerAccount (source), "funmodev2-car")
        x,y,getElementPosition (source)
        vehicle createVehicle (carID+2y+1)
        setElementID (vehiclegetAccountName (getPlayerAccount(source)))
        setElementData (source"hisCar"vehicle)
        outputChatBox ("Pojazd zespawnowany."source25500)
        if (getAccountData (getPlayerAccount(source), "funmodev2-carupg")) then
          local upgrades nil
          local upgrades = {}
          local upgrades getAccountData (getPlayerAccount(source), "funmodev2-carupg")
          for i,v in ipairs (upgrades) do
            addVehicleUpgrade (vehiclev)
          end
        end
        if (getAccountData (getPlayerAccount(source), "funmodev2-paintjob")) then
          local paintjob getAccountData (getPlayerAccount(source), "funmodev2-paintjob")
          setVehiclePaintjob (vehiclepaintjob)
        end
        if (getAccountData (getPlayerAccount(source), "funmodev2-carcolor1")) and (getAccountData (getPlayerAccount(source), "funmodev2-carcolor2")) then
          local c1 getAccountData (getPlayerAccount(source), "funmodev2-carcolor1")
          local c2 getAccountData (getPlayerAccount(source), "funmodev2-carcolor2")
          setVehicleColor (vehiclec1,c2,0,0)
        end
      else
        outputChatBox ("Nie posiadasz pojazdu."source25500)
      end
    else
      outputChatBox ("Nie siedzisz w pojezdzie!"source25500)
    end
  end
end
addEventHandler ("carSpawn"getRootElement(), carSpawn)

function carDestroy () 
  if  not (isGuestAccount (getPlayerAccount (source))) then
    if (isPedInVehicle (source)) then
      if (getElementID(getPedOccupiedVehicle(source)) == getAccountName (getPlayerAccount(source))) then
        setElementHealth (getElementData (source"hisCar"), 0)
        destroyElement (getPedOccupiedVehicle (source))
        removeElementData (source"hisCar")
        outputChatBox ("Pojazd odspawnowany."source25500)
      else
        outputChatBox ("To nie twoj pojazd!"source25500)
      end
    elseif (not (isPedInVehicle (source))) and (getElementData (source"hisCar")) and (getElementData (source"hisCar") ~= nilthen
      car=getElementData(source"hisCar")
      destroyElement(car)
      outputChatBox ("Pojazd odspawnowany."source25500)
      removeElementData (source"hisCar")
    end
  end
end
addEventHandler ("carDestroy"getRootElement(), carDestroy)


Pozdrawiam serdecznie :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-07-24, 22:55


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Na gotowca nie licz - co do zapisu. W danym miejscu zapisujesz za pomoc? getElementHealth, t? wartos? zapisujesz w bazie danych czy gdzie to masz zapisane i potem odczytujesz i ustawiasz za pomoc? setElementHealth.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-07-24, 23:16


wwa22442







Wiek: 38
Na forum: 4706 dni
Posty: 127

Piwa: 82

Respekt: 50

Ostrzeżeń: 20%
A tuning ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-07-25, 10:05


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Ch?opie, we? rozwi? to a nie piszesz zagadkami po jedno s?owo. Wiesz ile mo?liwo?ci daje jedno s?owo tuning?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-07-25, 15:30


wwa22442







Wiek: 38
Na forum: 4706 dni
Posty: 127

Piwa: 82

Respekt: 50

Ostrzeżeń: 20%
Chodzi mi o to ?e jak np. samoch?d zostanie stuningowany czyli dostanie - felgi, progi, wydech itp. to ?eby po odspawnowaniu mu si? to zapisa?o. I jak znowu zespawnuje to b?dzie to mia?.

Postaw piwo autorowi tego posta
 

 
Tagi: zapis :: uszkodzen
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