Jungs

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Jungs

  • Rank
    Newbie
  1. Ok, i'll try to explain. I have a freeroam server with few replaced vehicles, and i have first person view for this vehicles. I want to make steering wheel is turned by pressing "A" and "D" buttons. To implement it I can make in zmodeller a car without a steering wheel. And make steering wheel a separate object and add it into the game by this code function importTextures() txd = engineLoadTXD ( "steering_wheel.txd" ) engineImportTXD ( txd, 9822 ) dff = engineLoadDFF ( "steering_wheel.dff", 0 ) engineReplaceModel ( dff, 9822 ) end The problem is that I can not find a way how to implement the movement of object attached to the car. Hope you understand me, thank you.
  2. Maybe anyone have another idea how to make working steering whell? Please help
  3. Thank you for your response. I'm really new to scripting, this is my second script. The problem is that I can not find a way to move the object relative to the vehicle, only relatively the world. Hope you put me in the right direction. Thank you.
  4. Please help to correct my script. The idea of ​​the script is to move the object attached to the vehicle by bindkey. Currently object is attached, but it disappears by pressing the button. Sorry for my english, hope you understand and help me. Thank you. on = 0 function checkModel( theVehicle ) Car = getElementModel ( theVehicle ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkModel ) function onEnterVehicle ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 598 ) then bindKey ( source, "F10", "down", createObj ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) function createObj ( player ) if Car == 598 then if on == 0 then on = 1 veh = getPedOccupiedVehicle (player) x, y, z = getElementPosition (veh) object1 = createObject ( 1983, x, y, z ) attachElements ( object1, veh, 0, 0, 1.5) else on=0 destroyElement(object1) end end end left1 = function (player) moveObject (object1, 1000, 1, 0, 0) end function onBind () bindKey ( source, "a", "down", left1 ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onBind ) function offBind () unbindKey ( source, "a", "down", left1 ) end addEventHandler ( "onPlayerVehicleExit", getRootElement(), offBind ) I do not understand what I did wrong
  5. Спасибо огромное, это работает! Начинаю по-тихоньку понимать логику =) Вот готовый код (объект 2000 это из ресурса ParticlеObjects, а именно CamFlash) Получились очень забавные стробоскопы )) on = 0 function checkModel( theVehicle ) Car = getElementModel ( theVehicle ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkModel ) function onEnterVehicle ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 598 ) then bindKey ( source, "F12", "down", createStrab ) end end local Object, timer1, x, y, z; function createStrab ( player ) if Car == 598 then if on == 0 then on = 1 local veh = getPedOccupiedVehicle (player) x, y, z = getElementPosition (veh) timer1 = setTimer(function() Object1 = createObject ( 2000, x, y, z ); setElementCollisionsEnabled ( Object1, false ); attachElements ( Object1, veh, 0.555, 2.4, 0.08); setTimer(function() destroyElement(Object1) end, 100, 1) end, 500, 0); timer2 = setTimer(function() Object2 = createObject ( 2000, x, y, z ); setElementCollisionsEnabled ( Object2, false ); attachElements ( Object2, veh, 0.555, 2.4, 0.08); setTimer(function() destroyElement(Object2) end, 100, 1) end, 600, 0); timer3 = setTimer(function() Object3 = createObject ( 2000, x, y, z ); setElementCollisionsEnabled ( Object3, false ); attachElements ( Object3, veh, -0.555, 2.4, 0.08); setTimer(function() destroyElement(Object3) end, 100, 1) end, 550, 0); timer4 = setTimer(function() Object4 = createObject ( 2000, x, y, z ); setElementCollisionsEnabled ( Object4, false ); attachElements ( Object4, veh, -0.555, 2.4, 0.08); setTimer(function() destroyElement(Object4) end, 100, 1) end, 650, 0); else on=0 --- destroyElement(Object1); --- destroyElement(Object2); --- destroyElement(Object3); --- destroyElement(Object4); killTimer(timer1); killTimer(timer2); killTimer(timer3); killTimer(timer4); end end end function destroyStrab() ---destroyElement(Object1); ---destroyElement(Object2); ---destroyElement(Object3); ---destroyElement(Object4); killTimer(timer1); killTimer(timer2); killTimer(timer3); killTimer(timer4); end addEventHandler ( "onVehicleExplode", getRootElement(), destroyStrab ) function onExitVehicle ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 598 ) then unbindKey ( source, "F12", "down", createStrab ) if on == 1 then ---destroyElement(Object1); ---destroyElement(Object2); ---destroyElement(Object3); ---destroyElement(Object4); killTimer(timer1); killTimer(timer2); killTimer(timer3); killTimer(timer4); end end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), onExitVehicle ) addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) Теперь у меня появилась новая забавная идея и снова у меня пара вопросов ) вот код on = 0 function checkModel( theVehicle ) Car = getElementModel ( theVehicle ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkModel ) function onEnterVehicle ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 598 ) then bindKey ( source, "u", "down", createObject ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) function createOblect ( player ) if Car == 598 then if on == 0 then on = 1 local veh = getPedOccupiedVehicle (player) x, y, z = getElementPosition (veh) object = createObject ( 1973, x, y, z ) attachElements ( object, veh, 0, 0, 3) else on=0 destroyElement(object) end end end function onBind () bindKey ( source, "n", "down", move ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onBind ) function offBind () unbindKey ( source, "n", "down", move ) end addEventHandler ( "onPlayerVehicleExit", getRootElement(), offBind ) function move() moveObject (object, 1000, 1, 0, 3) end Идея скрипта в том чтобы в момент когда персонаж садится в авто, к авто аттачился объект, и этот объект двигался относительно авто по кнопке. У меня не получилось сделать чтобы объект аттачился сразу при посадке (без кнопки), и вместо того чтобы двигаться он исчезает.. Очень прошу направьте на путь истинный )
  6. Спасибо за ответ, объект не только должен быть аттачен но и появляться/исчезать без остановки согласно таймеру. Что только не пробовал, объект либо просто создается один раз, либо получаю кучу ошибок в дебаг
  7. Взываю о помощи опытных, подскажите почему это не работает и что поправить? function createObject (player) local veh = getPedOccupiedVehicle (player) local x, y, z = getElementPosition (player) Object = createObject ( 2002, x, y, z ) setElementCollisionsEnabled ( Object, false ) attachElements ( Object, veh, 0.62, 2.25, 0.18) end function recreateObject() destroyElement(Object) createObject() end createObject() setTimer(recreateObject,500,0)
  8. Ищу скриптера для написания одного скрипта и дальнейшего сотрудничества =)