Wysłany: 2014-12-08, 13:51
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
Witam.
Jak zrobi? aby ten kod, kt?ry usuwa pojazd podczas gdy gracz wyjdzie z serwera dzia?a? r?wnie? identycznie po wyj?ciu gracza z auta ?
addEventHandler ( "onPlayerQuit" , root , -- po wyjsciu z gry betoniarka znika
function ()
local betoniarka = auto [ source ]
if betoniarka then
if isElement ( betoniarka ) then
destroyElement ( betoniarka ) -- usuwa betoniarke
end
auto [ source ]= nil
end
end )
Pozdrawiam i za pomoc daje
Wysłany: 2014-12-08, 15:14
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
zapoznaj si? z tym eventem :
Wysłany: 2014-12-08, 21:15
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
Zrobi?em sobie takie co? :
Dot . Wychodzenia z serwera
addEventHandler ( "onPlayerQuit" , root , -- po wyjsciu z gry betoniarka znika
function ()
local betoniarka = auto [ source ]
if betoniarka then
if isElement ( betoniarka ) then
destroyElement ( betoniarka ) -- usuwa betoniarke
end
auto [ source ]= nil
end
end )
Dot . Wysiadania z pojazdu
function removeHelmetOnExit ( vehicle , seat , jacked )
local betoniarka = auto [ source ]
if betoniarka then
if isElement ( betoniarka ) then
destroyElement ( betoniarka ) -- usuwa betoniarke
end
auto [ source ]= nil
end
end
addEventHandler ( "onPlayerVehicleExit" , getRootElement (), removeHelmetOnExit )
Lecz, gdy wysiadam z pojazdu to pojazd nie znika...
Wysłany: 2014-12-08, 21:17
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
zauwa?, ?e w tym evencie source to gracz nie pojazd.
Wysłany: 2014-12-08, 21:33
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
Shuffle , czyli jak usune source to zadzia?a ?
[ Dodano : 2014-12-08, 21:48 ]
usun??em source i dalej nie dzia?a.
Wysłany: 2014-12-08, 21:52
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Nie masz go usun?? tylko zamieni? na odpowiednie argumenty.
Wysłany: 2014-12-08, 22:02
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
Shuffle , zrobi?em te? co? takiego :
addEventHandler ( "onPlayerVehicleExit" , root , -- po wyjsciu z gry betoniarka znika
function ( theVehicle )
local betoniarka = getElementModel ( theVehicle )
if betoniarka == 406 then
if isElement ( betoniarka ) then
destroyElement ( betoniarka ) -- usuwa betoniarke
end
end
end )
Ale te? to dzia?a? nie chce.
Wysłany: 2014-12-09, 07:05
Zgredek666
LUA
Wiek: 27 Na forum: 4722 dni Posty: 251
Nick w MP: Zgredek
Piwa : 442
Drugim argumentem tej funkcji jest betoniarka, a tak apropo to ten kod bedzie kasowa? ka?d? betoniark? a nie tylko gracza.
Wysłany: 2014-12-09, 12:13
markob0
Wiek: 27 Na forum: 4247 dni Posty: 151
Nick w MP: Markob
Piwa : 939
A nie mo?na zamieni? Onplayerquit z OnPlayerVehicleexit?
Wysłany: 2014-12-09, 12:43
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
zamiast zmiennej betoniarka u?yj theVehicle
Wysłany: 2014-12-09, 13:37
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
addEventHandler ( "onPlayerVehicleExit" , root , -- po wyjsciu z gry betoniarka znika
function ( theVehicle )
local theVehicle = getElementModel ( theVehicle )
if theVehicle == 406 then
if isElement ( theVehicle ) then
destroyElement ( theVehicle ) -- usuwa betoniarke
end
end
end )
kodzik mam taki i dalej nie usuwa betoniarki ;/
Wysłany: 2014-12-09, 13:41
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
nwm po co podmieniasz zmienn?..
addEventHandler ( "onPlayerVehicleExit" , root , -- po wyjsciu z gry betoniarka znika
function ( theVehicle )
local id = getElementModel ( theVehicle )
if id == 406 then
if isElement ( theVehicle ) then
destroyElement ( theVehicle ) -- usuwa betoniarke
end
end
end )
Wysłany: 2014-12-09, 14:22
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
Wszystko ?licznie dzia?a. Dzi?kuj? serdecznie
[ Dodano : 2014-12-09, 14:39 ]
A jak zrobi? aby w tym kodzie po wyj?ciu z pojazdu teleportowa?o gracza w te miejsce co jest w tym kodzie ?
addEventHandler ( "onPlayerVehicleExit" , root , -- po wyjsciu z gry betoniarka znika
function ( theVehicle )
local id = getElementModel ( theVehicle )
if id == 406 then
if isElement ( theVehicle ) then
destroyElement ( theVehicle ) -- usuwa betoniarke
SetPlayerPos ( playerid , 812 , 840 , 10 );
end
end
end )
Wysłany: 2014-12-09, 14:54
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
zamie?
SetPlayerPos(playerid, 812, 840, 10);
na
setElementPosition ( source , 812 , 840 , 10 )
Wysłany: 2014-12-09, 15:02
wwa22442
Wiek: 38 Na forum: 4706 dni Posty: 127
Piwa : 82
Shuffle , w?a?nie mia?em edytowa? m?j post bo ju? zrobi?em Ale za to ?e odpisa?e? to piwko poleci
Dzi?ki jeszcze raz i temat do zamkni?cia
Tagi: znikanie :: pojazdu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: