Wysłany: 2018-07-28, 02:20
DomineQ
lua mejster
Wiek: 22 Na forum: 3960 dni Posty: 309
Nick w MP: EZ3N
Piwa : 5186
Witam mam problem ze skryptem.
Chce pobra? pr?dko?? pojazdu i po starcie skryptu debug spami tym:
s? to te linijki:
if not element then return end
local vx , vy , vz = getElementVelocity ( element ) -- 36 linijka
mathSpeed =( vx ^ 2 + vy ^ 2 + vz ^ 2 )^ 0.5 * 1.8 * 100 -- 37 linijka
if mathSpeed < 0 then return end
Dodam, ?e b??d w 36 linijce nie ma sensu gdy? argument podaje dobry. - element to pojazd.
Za pomoc zostawiam
Wysłany: 2018-07-28, 02:40
Adis.exe
LUA Developer
Wiek: 23 Na forum: 3498 dni Posty: 292
Nick w MP: Adiś.exe
Piwa : 997
Wychodzi na to ?e "Element" to nie jest pojazd. Je?eli chcesz pobra? pr?dko?? to polecam ci funkcje z wiki
function getElementSpeed ( theElement , unit )
-- Check arguments for errors
assert ( isElement ( theElement ), "Bad argument 1 @ getElementSpeed (element expected, got " .. type ( theElement ) .. ")" )
local elementType = getElementType ( theElement )
assert ( elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile" , "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")" )
assert (( unit == nil or type ( unit ) == "string" or type ( unit ) == "number" ) and ( unit == nil or ( tonumber ( unit ) and ( tonumber ( unit ) == 0 or tonumber ( unit ) == 1 or tonumber ( unit ) == 2 )) or unit == "m/s" or unit == "km/h" or unit == "mph" ), "Bad argument 2 @ getElementSpeed (invalid speed unit)" )
-- Default to m / s if no unit specified and 'ignore' argument type if the string contains a number
unit = unit == nil and 0 or (( not tonumber ( unit )) and unit or tonumber ( unit ))
-- Setup our multiplier to convert the velocity to the specified unit
local mult = ( unit == 0 or unit == "m/s" ) and 50 or (( unit == 1 or unit == "km/h" ) and 180 or 111.84681456 )
-- Return the speed by calculating the length of the velocity vector , after converting the velocity to the specified unit
return ( Vector3 ( getElementVelocity ( theElement )) * mult ). length
end
przy czym unit :
0 = m/s
1 = km/h
2 = mph
tu masz link do wiki :
https://wiki.multitheftauto.com/wiki/GetElementSpeed
Chyba ?e chcesz koniecznie u?y? swojego kodu, je?eli tak poka? czym jest "element". A ten drugi b??d zwi?zany z warto?ci? vx jest spowodowany (tak mi si? wydaje) tym ?e je?eli getElementVelocity ma z?y arg co za tym idzie funkcja nie zwraca warto?ci takiej jakiej powinna, czyli jednym s?owem ?le si? wykonuje
Podpis
KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828
Użytkownik : 05.11.2016
GTAO Member : 20.02.2019
Support-Team : 25.07.2018
Support-Team : 19.01.2019
Test Mod : 08.02.2019
Więcej szczegółów
Wystawiono 1 piw(a):DomineQ
Wysłany: 2018-07-28, 21:17
DomineQ
lua mejster
Wiek: 22 Na forum: 3960 dni Posty: 309
Nick w MP: EZ3N
Piwa : 5186
Poradzi?em sobie.
Dzi?ki za nakierowanie.
Tagi: getelementvelocity :: zly :: argument :: chodz :: podaje :: dobry
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: