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

Wysłany: 2019-12-09, 15:11


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

Witam mam problem z salonem.
Mianowicie chodzi o to, ze funkcja warpPlayerIntoVehicle wprowadzona do kodu, nie dziala i sa z nia problemy w DB3


Server Side:
    local vehicle=plr:getOccupiedVehicle()
removePedFromVehicle(plr)
      posXposYposZposRXposRYposRZ unpack(getElementData(vehicle"pos"))
     destroyElement(vehicle)
     local rid=getElementData(plr,'player:rid') or 0
    takePlayerMoney(plrcost)
   destroyElement(vehicle)
    outputChatBox("#00ff00✔ #ffffffZakupi?e? sw?j pojazd #00ff00"..getVehicleNameFromModel(model).."#ffffff."plr255255255true)
    resrowslastID exports["rpg-db"]:dbSet("INSERT INTO rpg_pojazdy (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)"modelgetElementData(plr,"player:sid"),mileage,"true")
  auto exports["rpg-vehicles"]:onRespawnVehicles(_,lastID,{ posXposYposZposRXposRYposRZ})
    warpPlayerIntoVehicle plrauto end)


Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-09, 19:57


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Zaleca si? u?ywanie funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

warpPedIntoVehicle


B??d m?wi o braku poje?dzie w argumencie 2. I to samo mo?na wyczyta? z kodu, nigdzie nie definiujesz zmiennej 'auto'. Nigdzie nie tworzysz takiego pojazdu, wi?c nie ma co si? dziwi?, ?e nie dzia?a.

Uprzedz? pytanie: auto tworzymy za pomoc? funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

createVehicle


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
NoKill1997
Wysłany: 2019-12-09, 20:12


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

"Wilq" napisał/a:

Zaleca si? u?ywanie funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

warpPedIntoVehicle


B??d m?wi o braku poje?dzie w argumencie 2. I to samo mo?na wyczyta? z kodu, nigdzie nie definiujesz zmiennej 'auto'. Nigdzie nie tworzysz takiego pojazdu, wi?c nie ma co si? dziwi?, ?e nie dzia?a.

Uprzedz? pytanie: auto tworzymy za pomoc? funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

createVehicle

Tylko problem jest taki, ze autko sie tworzy.

Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-09, 20:16


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Racja, jednak co? si? definiuje. Klucz to s?owo co?, pytanie czy funkcja 'onRespawnVehicles' zwraca Ci zmienn? pojazdu. Zobacz do tej funkcji lub wklej jej kod tutaj.

Formu?a powinna wygl?da? tak:
return <tutaj zmienna pojazdu w tej funkcji>


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
NoKill1997
Wysłany: 2019-12-10, 19:48


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

function onRespawnVehicles(_,id,possplr)
    -- Settings (QUERY)
    if id then
        result=exports["rpg-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=1 AND id=?"id)
        query=exports["rpg-db"]:dbSet("UPDATE pystories_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["rpg-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=0")
    end

    -- Pairs
    for ile,vehicle in pairs(result) do
        vehicles=ile

        if id then pos={poss[1], poss[2], poss[3], poss[4], poss[5], poss[6]}
        else pos=split(vehicle["pos"], ","end

        local color=split(vehicle["color"], ",")
        local lights=split(vehicle["headlights"], ",")

        local veh=createVehicle(vehicle["model"], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
        warpPedIntoVehicle (plrveh ) 
        setVehicleColor(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
         setVehiclePlateText(vehtostring("LSg "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-10, 19:54


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

I to jest ca?a funkcja? Je?li tak, to brakuje w niej 2 end?w no i zwracania pojazdu, kt?ry si? tworzy.

Ale, ?e definiujesz tu pojazd, to wklej w tej p?tli t? linijk?:
return veh


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
NoKill1997
Wysłany: 2019-12-10, 21:05


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

function onRespawnVehicles(_,id,poss)
    -- Settings (QUERY)
    if id then
        result=exports["rpg-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=1 AND id=?"id)
        query=exports["rpg-db"]:dbSet("UPDATE pystories_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["rpg-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=0")
    end

    -- Pairs
    for ile,vehicle in pairs(result) do
        vehicles=ile

        if id then pos={poss[1], poss[2], poss[3], poss[4], poss[5], poss[6]}
        else pos=split(vehicle["pos"], ","end

        local color=split(vehicle["color"], ",")
        local lights=split(vehicle["headlights"], ",")

        local veh=createVehicle(vehicle["model"], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
        setVehicleColor(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
         setVehiclePlateText(vehtostring("LSg "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end
        setElementHealth(vehvehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id"vehicle["id"])
        setElementData(veh,"vehicle:fuel"vehicle["fuel"])
        setElementData(veh,"vehicle:desc"vehicle["text"] or false)
        setElementData(veh,"vehicle:mileage"vehicle["mileage"])
        setElementData(veh,"vehicle:driver"vehicle["driver"])
        setElementData(veh,"vehicle:ownedGroup"vehicle["ownedGroup"])
        setElementData(veh,"vehicle:ownedPlayer"vehicle["ownedPlayer"])
        
        local mk1 vehicle['mk1']
        local mk1 vehicle['mk2']
        local xfour vehicle['awd']
        
        if (type(vehicle['rent']) == "string"then
        local tabelka = {}
        local rente split(vehicle['rent'], ',')
        for k,v in ipairs(rente) do
        table.insert(tabelka,v)
        end
        setElementData(veh,"vehicle:rent"tabelka or false)
        else
        setElementData(veh,"vehicle:rent",0)
        end
        
        if tonumber(xfour) == 1 then
        setVehicleHandling(veh,"driveType","awd")
        end
        
        if tonumber(mk1) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        local masa getVehicleHandlingProperty(veh,"mass")
        local masa2 getVehicleHandlingProperty(veh,"turnMass")
        local xd getVehicleHandlingProperty(veh,"tractionMultiplier")
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        setVehicleHandling(veh,"engineAcceleration",fast+0.5)
        setVehicleHandling(veh,"maxVelocity",maxfast+6)
        setVehicleHandling(veh,"mass",masa+100)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"steeringLock",40)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(mk2) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        local masa getVehicleHandlingProperty(veh,"mass")
        local masa2 getVehicleHandlingProperty(veh,"turnMass")
        local xd getVehicleHandlingProperty(veh,"tractionMultiplier")
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        setVehicleHandling(veh,"engineAcceleration",fast+1.3)
        setVehicleHandling(veh,"maxVelocity",maxfast+14)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.2)
        setVehicleHandling(veh,"mass",masa+150)
        setVehicleHandling(veh,"steeringLock",42)
        setVehicleHandling(veh,"dragCoeff",coef-0.21)
        end
        
    --[[    if vehicle["rearlights"] ~= "" then
        setElementData(veh,"vehicle:light"vehicle["rearlights"])
        else
        setElementData(veh,"vehicle:light""High Quality")
        end]]--
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(veh2222)
        else
            setElementData(veh,"vehicle:block"false)
        end
        local rodzajneonu=tonumber(getElementData(veh,"neony"))
        if getElementData(veh,"neony") ~= 0 then
        local m getElementModel(veh)
        local of
        if not nlOffsets[mthen
        of={-1,0,-0.5}
        else
        of=nlOffsets[m]
        end
        neon1=createObject(nlIDX[rodzajneonu],0,0,0)
        neon2=createObject(nlIDX[rodzajneonu],0,0,0)
        setElementData(veh,"zneony", {neon1neon2})
        attachElements(neon1,veh,of[1],of[2],of[3])
        attachElements(neon2,veh,-of[1],of[2],of[3])
        end

        for i,v in ipairs(split(vehicle["tuning"], ",")) do addVehicleUpgrade(vehvend
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(vehitonumber(v)) end
        setVehicleDamageProof(vehtrue)
    end
    outputDebugString("Loaded "..vehicles.." vehicles.")
    return veh
end


[ Dodano: 2019-12-10, 21:07 ]
Zrobilem cos takiego, ale nadal wystepuje ten sam blad

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-10, 21:15


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Cytat:

Wklej w p?tli t? linijk?:
return veh


W P?TLI. ?eby zwraca?o ka?dy pojazd, przy ka?dym wywo?aniu funkcji.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
NoKill1997
Wysłany: 2019-12-10, 21:25


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

@c dziekuje za pomoc

Postaw piwo autorowi tego posta
 

 
Tagi: teleport :: auta
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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