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

Wysłany: 2020-08-04, 20:46


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Siemanko chcia?em dorobi? do serwera przydatn? dla mnie komend?, wszystko pi?knie tylko ?e gracza nie teleportuje do pojazdu :P

addCommandHandler("respawnauta",function(plr,cmd,id,ccar)
   if getAdmin(plr,4then
   local veh getPedOccupiedVehicle(plr)
   if not id or not tonumber(idthen
        outputChatBox("MS♛ •  Podaj id pojazdu!"plr25500)
        return
    end
    if not veh then
       outputChatBox("MS♛ •  Musisz by? w pojed?dzie."plr255,0,0)
       return
    end
    local id getElementData(veh"vehicle:id")
    local x,y,z=getElementPosition(veh)
    local rx,ry,rz=getElementRotation(veh)
    local aktualna_pozycja={x,y,z,rx,ry,rz}
    exports["pystories-vehicles"]:onSaveVehicle(veh)
    destroyElement(veh)
    exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1,tp_to_parking=? WHERE id=?","Respawn RCON"id)
    setTimer(function(graczidaktualna_pozycja)
        local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
        warpPlayerIntoVehicle plr)
    end501clientidaktualna_pozycja)
    end
end)


Podpis


Modern Stories
Discord
https://discord.gg/MRJSYq8
Forum
https://msmta.pl
Panel Gracza
https://panel.msmta.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 20:51


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie zdefiniowales zmiennej gracza w funkcji timera. U?yj plr w 4 argumencie setTimer a w timerze u?yj gracz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 21:01


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
setTimer(function(graczidaktualna_pozycjaplr)
        local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
        warpPlayerIntoVehicle plr)
        outputChatBox("MS♛ •  Pomy?lnie prze?adowa?e? pojazd o id "..idplr0,255,0)
    end501graczidaktualna_pozycja)


Tak?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 21:05


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

setTimer(function(graczidaktualna_pozycja)
        local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
        warpPlayerIntoVehicle plr)
    end501clientidaktualna_pozycja)


Tu masz blad


setTimer(function(graczidaktualna_pozycja,plr)
        local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
        warpPlayerIntoVehicle plr)
    end501clientidaktualna_pozycja,plr)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 21:11


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Nie no chyba nie rozumiem. To co wys?a?e? jest dobrze? mi co? nie dzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 22:59


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

To by? przyk?ad, ka?dy element u?ywany w setTimerze musisz przenie?? do niego.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 23:16


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
setTimer(function(graczidaktualna_pozycja,plr)
        local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
        warpPlayerIntoVehicle gracz)
    end501graczidaktualna_pozycja,plr)
    end


Chodzi o takie cos ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 23:32


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

A masz zdefiniowane gracz poza timerem? Musisz tylko wstawi? zmienna gracza w 4 argumencie timera.

Z reszt?, jaki jest sens timera po 50ms? Nie mo?esz wykona? tego od razu, b?dzie pro?ciej i problem z g?owy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-04, 23:47


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
    warpPlayerIntoVehicle plr)
    end


nawet po wywaleniu setTimera nie teleportuje do auta :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 07:55


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

warpPedIntoVehicle


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 12:38


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
 warpPedIntoVehicle prlxTutaj tez kombinowa?em ale nie dzia?:


No kurde nwm jak to zrobi? :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 13:02


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Poka? ca?y kod z funkcj? "warpPedIntoVehicle". Ten export zwraca poprawny element?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 14:00


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
addCommandHandler("respawnauta",function(plr,cmd,id,ccar)
   if getAdmin(plr,4then
   local veh getPedOccupiedVehicle(plr)
   if not id or not tonumber(idthen
        outputChatBox("MS♛ •  Podaj id pojazdu!"plr25500)
        return
    end
    if not veh then
       outputChatBox("MS♛ •  Musisz by? w pojed?dzie."plr255,0,0)
       return
    end
    local id getElementData(veh"vehicle:id")
    local x,y,z=getElementPosition(veh)
    local rx,ry,rz=getElementRotation(veh)
    local aktualna_pozycja={x,y,z,rx,ry,rz}
    exports["pystories-vehicles"]:onSaveVehicle(veh)
    destroyElement(veh)
    exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1,tp_to_parking=? WHERE id=?","Respawn RCON"id)
        local x exports["pystories-vehicles"]:onRespawnVehicles(_,tonumber(id), aktualna_pozycja)
        warpPlayerIntoVehicle plr)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 14:57


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pr?bowa?e?
warpPedIntoVehicle(plrx)


Poka? funkcj?/ co Ci zwraca ten export.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 17:07


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Co zwraca zmienna "x" z tabeli MySql? Na pewno masz dodane dbPoll ?

Postaw piwo autorowi tego posta
 

 
Tagi: warpplayerintovehicle
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