-
Posts
96 -
Joined
-
Last visited
Everything posted by lcd1232
-
u must send parametr player in timer [lua]setTimer(function, 1000, 0, player)
-
I think like this commands = {} commands.engine = 'setengine' commands.lock = 'lock' newcommands = {} newcommands.engine = get ( "engine" ) or commands.engine newcommands.lock = get( "lock" ) or commands.lock addCommandHandler(newcommands.engine, testFunction) addCommandHandler(newcommands.lock, test1Function)
-
https://wiki.multitheftauto.com/wiki/Settings_system
-
usually .lua
-
So we can't help u
-
U must put there uncompiled versions of scripts, because u can't compile script which are already compiled.
-
Show source of script, not compiled version of server.lua
-
or use setElementStreamable
-
to compile scripts use luac.multitheftauto.com
-
it doesn't work because vehicle have rotation
-
I have problem with getComponentPosition. I want to find coordinates of vehicle's part, but it doesn't work. Here code: addCommandHandler("getposit", function () --getPositionFromElementOffset = exports.functions:getPositionFromElementOffset local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) local vx,vy,vz = getElementPosition( theVehicle ) local cx,cy,cz = getVehicleComponentPosition( theVehicle, 'bump_rear_dummy' ) local vfx,vfy,vfz = getElementRotation( theVehicle ) local result = 'vx = '..vx..' vy = '..vy..' vz = '..vz outputDebugString( result ) result = 'cx = '..cx..' cy = '..cy..' cz = '..cz outputDebugString( result ) result = 'vfx = '..vfx..' vfy = '..vfy..' vfz = '..vfz outputDebugString( result ) local zx, zy, zz = exports.functions:getPositionFromElementOffset( theVehicle, cx, cy, cz ) --local zx, zy, zz = call( getResourceFromName( 'functions' ), 'getPositionFromElementOffset', theVehicle, 0, 4, 0 ) createColSphere( zx, zy, zz, 1 ) end ) getPositionFromElementOffset: function getPositionFromElementOffset( theElement, offX, offY, offZ ) local m = getElementMatrix ( theElement ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end Result: http://s010.radikal.ru/i312/1408/4b/7f3906e25539.png
-
viewtopic.php?f=108&t=36481
-
Трейлер шикарный. Удачи проекту.
-
-- this function adds new vehicle without replace old boolean addVehicle( int idModel, table handling, txd txdTexture, dff dffTexture ) -- model must be unique number -- this function adds new object without replace old boolean addObject( int id, col colTexture, txd txdTexture, dff dffTexture ) -- id must be unique nubmer
-
Все равно плохо понял. А если при событии "onVehicleDestroy" указать root или getRootElement(), то когда оно будет срабатывать?
-
Не могу до сих пор понять для чего нужен 2 параметр в функции и что в нем можно использовать addEventHandler( 'event', root, function )
-
Если ты не понял, то тоже объясню. Если ты не будешь учить lua, то не сможешь ничего сам написать, а соответственно будешь просить помощи у всех. Тут тебе могут подсказать как что-то делать, но не писать за тебя. Так что у тебя 2 варианта: либо плати, либо учи.
-
Нет, элемент theVehicle существует, просто во втором случае он не хочет инвертировать (not). Еще вопрос: функция setHelicopterRotorSpeed работает странно, например нужно вызывать её при событии onClientPreRender каждый раз, чтобы пропеллер не крутился.
-
Пробовал, то же самое.
-
Если ввести в автомобиле outputChatBox( tostring( not getVehicleType( theVehicle ) == 'Automobile' ) ) то выводит false, однако если ввести outputChatBox( tostring( not getVehicleType( theVehicle ) == 'Plane' ) ) то выводит все равно false. В чем проблема? И как узнать какое расстояние прошел автомобиль за какой-то промежуток времени? (можно по разнице координат, но может он ездит вперед, назад)
-
Написал функцию для бессмертных машин. Но почему-то евент не отменяется. Server Side function MakeImmortal( thePlayer ) theText = { [true] = "Поздравляем! Вы теперь бессмертны =)", [false] = "Вот так вот! Смерть теперь видет Вас =)" } setElementData( thePlayer, "Immortal", not getElementData( thePlayer, "Immortal" ) ) outputChatBox( theText[ getElementData( thePlayer, "Immortal" ) ], thePlayer ) end function ImmortalVehicle() local theDriver = getVehicleController( source ) if ( theDriver ~= false ) and ( getElementData( theDriver, "Immortal" ) == true ) then cancelEvent() outputChatBox( tostring( wasEventCancelled() ) ) end end addCommandHandler( "baguvix", MakeImmortal ) addEventHandler( "onVehicleDamage", getRootElement(), ImmortalVehicle ) meta.xml <meta> <script src='assasin.lua' type='server' /> </meta>