Wysłany: 2016-02-20, 22:10
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
createBlip (- 2633.43 ,- 33.30 , 4.06 )
local pojazdy = {
{- 2633.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
{- 2630.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
{- 2627.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
{- 2624.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
}
for i , v in ipairs ( pojazdy ) do
local veh = createVehicle ( 574 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ])
setElementData ( veh , "pojazd_paliwo" , 100 )
setElementData ( veh , "pojazd_opis" , "Praca Dorywcza\nSweepery" )
setElementFrozen ( veh , true )
end
addEventHandler ( "onVehicleEnter" , resourceRoot ,
function ( player , seat )
if seat == 0 then
local veh = getPedOccupiedVehicle ( player )
setElementData ( veh , "pojazd_opis" , "Zape?nienie: 0%" )
setElementData ( veh , "smieci" , 0 )
local veh = getPedOccupiedVehicle ( player )
local speed = getElementVelocity ( veh )
if speed > 5 then
setTimer (function()
local smieci = getElementData ( veh , "smieci" )
smieci = smieci + 1
setElementData ( veh , "pojazd_opis" , "Zape?nienie: " .. smieci .. "%" )
setElementData ( veh , "smieci" , smieci )
end , 6000 , 0 )
else return end
end
end
)
addEventHandler ( "onVehicleStartExit" , resourceRoot ,
function ( player , seat )
if seat == 0 then
local veh = getPedOccupiedVehicle ( player )
setTimer (function()
respawnVehicle ( veh )
setElementData ( veh , "pojazd_opis" , "Praca Dorywcza\nSweepery" )
setElementData ( veh , "smieci" , 0 )
end , 2500 , 1 )
end
end
)
Co tu jest ?le nie nalicza mi element daty db3 czyste
Wysłany: 2016-02-20, 22:38
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4260 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
Ale kt?rych ? bo troszk? ich jest.
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-20, 22:38
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Tych co jest setTimer
Wysłany: 2016-02-20, 22:53
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4260 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
Po co to w wsiadaniu do sweepera ?
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-02-20, 23:01
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
To raz, a po drugie, getElementVelocity, zwraca 3 warto?ci... Nwm skad Ci sie tam wzielo speed, musisz u?y? wzoru, kt?ry r?wnie? jest na wiki, aby obliczy? pr?dko??.
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2016-02-21, 15:04
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Witam czy tak jest dobrze? Bo dalej nie dzia?a
createBlip (- 2633.43 ,- 33.30 , 4.06 )
local pojazdy = {
{- 2633.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
{- 2630.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
{- 2627.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
{- 2624.43 ,- 33.30 , 4.06 , 0 , 360 , 180 },
}
for i , v in ipairs ( pojazdy ) do
local veh = createVehicle ( 574 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ])
setElementData ( veh , "pojazd_paliwo" , 100 )
setElementData ( veh , "pojazd_opis" , "Praca Dorywcza\nSweepery" )
setElementFrozen ( veh , true )
end
addEventHandler ( "onVehicleEnter" , resourceRoot ,
function ( player , seat )
if seat == 0 then
local veh = getPedOccupiedVehicle ( player )
setElementData ( veh , "pojazd_opis" , "Praca dorywcza Sweepery" )
local veh = getPedOccupiedVehicle ( player )
local sx , sy , sz = getElementVelocity ( veh )
local kmhs = math . ceil ((( sx ^ 2 + sy ^ 2 + sz ^ 2 )^( 0.5 ))* 155 )
if kmhs > 15 then
setTimer (function()
givePlayerMoney ( player , 4 )
outputChatBox ( "+ 4 EUR" , player )
end , 6000 , 0 )
else return end
end
end
)
addEventHandler ( "onVehicleStartExit" , resourceRoot ,
function ( player , seat )
if seat == 0 then
local veh = getPedOccupiedVehicle ( player )
setTimer (function()
respawnVehicle ( veh )
setElementData ( veh , "pojazd_opis" , "Praca Dorywcza\nSweepery" )
setElementData ( veh , "smieci" , 0 )
end , 2500 , 1 )
end
end
)
Wysłany: 2016-02-21, 22:08
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
Zioms... Wypie?dol ten timer z ?rodka funkcji, zr?b to tak, aby sprawdza?o co sekund?, czy tam ile? sekund, ale w timerze sprawdzaj, czy gracz jest wewn?trz sweepera, czy ma element dat? pracy itd itd.
Nie podczas wsiadania do auta...
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2016-02-22, 01:08
dudeks
Wiek: 31 Na forum: 6576 dni Posty: 171
Piwa : 89
addEventHandler ( "onVehicleEnter" , resourceRoot , function ( player , seat )
if seat == 0 then
local veh = getPedOccupiedVehicle ( player )
setElementData ( veh , "pojazd_opis" , "Praca dorywcza Sweepery" )
local veh = getPedOccupiedVehicle ( player )
setTimer (function( gracz , sweeper )
local sx , sy , sz = getElementVelocity ( sweeper )
local kmhs = math . ceil ((( sx ^ 2 + sy ^ 2 + sz ^ 2 )^( 0.5 ))* 155 )
if kmhs > 15 then
givePlayerMoney ( gracz , 4 )
outputChatBox ( "+ 4 EUR" , gracz )
end
end , 6000 , 0 , player , veh )
end
end )
Tagi: sweeper
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: