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

Wysłany: 2018-03-19, 23:35


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

Witam, posiadam GM PYS 3.0 i mam problem, poniewa? gdy uszkodzi si? pojazd podczas zdawania prawa jazdy to posta? zostaje w tym miejscu a chcia?bym ?eby cofa?o do miejsca zdawania
--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

--[[local marker2=createMarker(-2050.29,-106.16,35.24,"corona",2,170,200,0)

addEventHandler("onMarkerHit", marker2, function(el,md)
 setElementPosition(el,-2044.69,-94.57,35.17 )
end)--]]

--local zone = createColCuboid(-157.62562561035, 1108.4052734375, 18.613729476929, 7, 9.8, 6.4)

addEvent("license:do",true)
addEventHandler("license:do", resourceRoot, function(cost,selected)
    if tonumber(cost) <= getPlayerMoney(client) then
        takePlayerMoney(client,cost)
    end

    local veh=nil
    --if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("* Miejsce respu zaj?te, poczekaj a? kto? wyjedzie.",client) return end
    if selected == "A" then veh=createVehicle(586, -1943.73,1001.21,35.18, 356.3, 0.1, 270)
    elseif selected == "B" then veh=createVehicle(436, -1943.73,1001.21,35.18, 356.1, 0.1, 270)
    elseif selected == "C" then veh=createVehicle(414, -1943.73,1001.21,35.18, 360, 0.4, 270)
    elseif selected == "L" then veh=createVehicle(593, -1943.73,1001.21,35.18, 360.0, 179.0) end
    if not veh then return end
    if selected == "L" then
    setElementData(veh,"vehicle:desc","Egzamin Licencji Lotniczej\nKategoria "..selected.."\n! Prosz? zachowa? ostro?no?? !")
    else
    setElementData(veh,"vehicle:desc","Egzamin Prawa Jazdy\nKategoria "..selected.."\n! Prosz? zachowa? ostro?no?? !")
    end
    setElementData(veh,"vehicle:mileage",16442)
    setElementData(veh,"vehicle:fuel",100)
    setElementData(veh,"vehicle:lic",true)

    setElementDimension(client,0)
    setElementInterior(client,0)
    showPlayerHudComponent(client, "radar", true)
    warpPedIntoVehicle(client,veh)
    triggerClientEvent(client, "license:start", resourceRoot, selected, veh)
    --outputChatBox("* "..getPlayerName(client).." rozpocz??(??a) egzamin prawa jazdy, kategoria: "..selected.."", root, 255, 0, 0)
end)

addEvent("license:vehdel", true)
addEventHandler("license:vehdel", resourceRoot, function(veh)
    destroyElement(veh)
end)

addEventHandler("onPlayerQuit", root, function()
    local veh=getPedOccupiedVehicle(source)
    if not veh then return end
    if getVehicleController(veh) ~= source then return end
    if not getElementData(veh,"vehicle:lic") then return end
    destroyElement(veh)
end)

addEventHandler("onVehicleDamage", resourceRoot, function(loss)
    local kierowca=getVehicleController(source)
    if not kierowca then return end
    if not getElementData(source,"vehicle:lic") then return end
    destroyElement(source)
    outputChatBox("* Uszkodzi?e?(a?) pojazd, nie zdajesz egzaminu!", kierowca, 255, 0, 0)
    triggerClientEvent(kierowca, "license:finish", resourceRoot, true)
end)

addEventHandler("onVehicleStartExit", resourceRoot, function()
    cancelEvent()
end)

addCommandHandler("lotgp", function(plr,cmd)
    local x,y,z=getElementPosition(plr)
    local p=string.format("{%.02f, %.02f, %.02f},", x,y,z)
    outputChatBox(p, plr)
end)

addCommandHandler("lotgp2", function(plr,cmd)
    local veh=getPedOccupiedVehicle(plr)
    if not veh then return end
    local x,y,z=getElementPosition(veh)
    local rx,ry,rz=getElementRotation(veh)
    local p=string.format("%.02f, %.02f, %.02f, %.02f, %.02f, %.02f", x,y,z,rx,ry,rz)
    outputChatBox(p, plr)
end)


Ostatnio zmieniony przez Atroth 2018-03-21, 22:41, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-20, 17:18


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

U?yj,


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-20, 18:03


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

"Ciastuu?" napisał/a:

U?yj,


Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Dopisywalem ale nie wiem dokladnie gdzie to powinno sie znajdowac. Mog?by? to zrobi??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-20, 18:38


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

W tym miejscu dodajesz powy?szy kod,

addEventHandler("onVehicleDamage", resourceRoot, function(loss)
    local kierowca=getVehicleController(source)
    if not kierowca then return end
    if not getElementData(source,"vehicle:lic") then return end
    destroyElement(source)
    outputChatBox("* Uszkodzi?e?(a?) pojazd, nie zdajesz egzaminu!", kierowca, 255, 0, 0)
    triggerClientEvent(kierowca, "license:finish", resourceRoot, true)
end)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-20, 19:12


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

Zrobi?em tak i nadal nie cofa

addEventHandler("onVehicleDamage", resourceRoot, function(loss)
    local kierowca=getVehicleController(source)
    if not kierowca then return end
    if not getElementData(source,"vehicle:lic") then return end
    destroyElement(source)
    outputChatBox("* Uszkodzi?e?(a?) pojazd, nie zdajesz egzaminu!", kierowca, 255, 0, 0)
    triggerClientEvent(kierowca, "license:finish", resourceRoot, true)
    setElementPosition(source, -1958.48,1045.23,55.72)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-20, 21:35


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

"readreis" napisał/a:

Zrobi?em tak i nadal nie cofa

addEventHandler("onVehicleDamage", resourceRoot, function(loss)
    local kierowca=getVehicleController(source)
    if not kierowca then return end
    if not getElementData(source,"vehicle:lic") then return end
    destroyElement(source)
    outputChatBox("* Uszkodzi?e?(a?) pojazd, nie zdajesz egzaminu!", kierowca, 255, 0, 0)
    triggerClientEvent(kierowca, "license:finish", resourceRoot, true)
    setElementPosition(source, -1958.48,1045.23,55.72)
end)


w tym przypadku el. source jest odpowiedzialny za pojazd. zamie? na:
     setElementPosition(kierowca, -1958.48,1045.23,55.72) 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-20, 21:47


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

"TeeNekk" napisał/a:

"readreis" napisał/a:

Zrobi?em tak i nadal nie cofa

addEventHandler("onVehicleDamage", resourceRoot, function(loss)
    local kierowca=getVehicleController(source)
    if not kierowca then return end
    if not getElementData(source,"vehicle:lic") then return end
    destroyElement(source)
    outputChatBox("* Uszkodzi?e?(a?) pojazd, nie zdajesz egzaminu!", kierowca, 255, 0, 0)
    triggerClientEvent(kierowca, "license:finish", resourceRoot, true)
    setElementPosition(source, -1958.48,1045.23,55.72)
end)


w tym przypadku el. source jest odpowiedzialny za pojazd. zamie? na:
     setElementPosition(kierowca, -1958.48,1045.23,55.72) 


Te? nie dzia?a ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-21, 19:52


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

"readreis" napisał/a:

Te? nie dzia?a ;/


musi dzia?a?. Jaie? b??dy z /debugscript 3? i poka? jak to wklei?e?, bo mo?e pope?ni?e? b??d.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-21, 19:53


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

teraz zmienilem troche kod i cofa mnie w wyznaczone miejsce wraz z autem ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-21, 19:57


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

"readreis" napisał/a:

teraz zmienilem troche kod i cofa mnie w wyznaczone miejsce wraz z autem ;/


Poka? ten kod

Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
readreis
Wysłany: 2018-03-21, 19:58


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

addEvent("onVehicleDamage", true)
addEventHandler("onVehicleDamage", root, function()
    setElementPosition(source, -2000.34,1045.16,55.57)
    setElementData(source, "pj_p2", false)
    outputChatBox("** Obla?e?/a? egzamin na prawo jazdy! Pojazd uszkodzony!", source)
    toggleControl(source, "enter_exit", true)
end)


w db3 wyskakuje:
WARNIN:[pystories]/[skrypty]/pystories-offices/license/s_zdawanie.lua:70: Bad argument @ 'toggleControl' [Expected player at argument 1, got vehicle]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-21, 20:46


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

"readreis" napisał/a:

addEvent("onVehicleDamage", true)
addEventHandler("onVehicleDamage", root, function()
    setElementPosition(source, -2000.34,1045.16,55.57)
    setElementData(source, "pj_p2", false)
    outputChatBox("** Obla?e?/a? egzamin na prawo jazdy! Pojazd uszkodzony!", source)
    toggleControl(source, "enter_exit", true)
end)


w db3 wyskakuje:
WARNIN:[pystories]/[skrypty]/pystories-offices/license/s_zdawanie.lua:70: Bad argument @ 'toggleControl' [Expected player at argument 1, got vehicle]


Przy evencie onVehicleDamage SOURCE odpowiada za pojazd! wi?c, nic dziwnego ?e cofa ci? wraz z pojazdem.


addEventHandler("onVehicleDamage",root,function()
if getElementData(source,"vehicle:lic") then
local kierowca = getVehicleController ( source )
destroyElement(source)
setElementPosition(kierowca, -2000.34,1045.16,55.57)
outputChatBox("Obla?e?/a? egzamin",kierowca,255,0,0)
end
end)

musi dzia?a?. Testowane.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-21, 22:33


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

TeeNekk, nie rozumiem czemu u mnie to nie dziala z twoim kodem usuwa auto postac zostaje w tym samym miejscu a punkty z egzaminu nie znikaja ;/ poddaje sie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-22, 19:47


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

a usun??e? to?
 addEvent("onVehicleDamage", true) 


Podpis
Pomogłem Ci
? Może zostawiłbyś za to piwko, lub respekt? Dzięki!
Mój projekt:
?
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-22, 22:02


readreis







Wiek: 37
Na forum: 4049 dni
Posty: 62

Piwa: 4

Respekt: 50

TeeNekk, caly kod podmienilem na twoj

Postaw piwo autorowi tego posta
 

 
Tagi: pys :: 3.0 :: prawo :: jazdy
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