Jump to content

help hydra smoke script


ReXXuZ

Recommended Posts

you can attach the object "CJ_SMOKE_MACH" (ID 2780) to the hydra and that going to be a good effect. This is a example :

function hydrasm( player )
if isPedInVehicle (player) then
local veh = getPedOccupiedVehicle(player) 
 local id = getElementModel ( veh )
    if id == 520 then
local x,y,z = getElementPosition(player)
local smoke = createObject(2780, x, y, z)
setElementCollisionsEnabled (smoke, false)
attachElements(smoke, veh,0,0,0)  --Here you can set the position of the effect (for default the effect going to be in the center of the hydra).
      end
   end
end 
addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )

 

Link to comment
1 hour ago, <~kamikaze~> said:

you can attach the object "CJ_SMOKE_MACH" (ID 2780) to the hydra and that going to be a good effect. This is a example :

  1. function hydrasm( player )
  2. if isPedInVehicle (player) then
  3. local veh = getPedOccupiedVehicle(player)
  4. local id = getElementModel ( veh )
  5. if id == 520 then
  6. local x,y,z = getElementPosition(player)
  7. local smoke = createObject(2780, x, y, z)
  8. setElementCollisionsEnabled (smoke, false)
  9. attachElements(smoke, veh,0,0,0) --Here you can set the position of the effect (for default the effect going to be in the center of the hydra).
  10. end
  11. end
  12. end
  13. addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )

 

I want you out of the wings of the smoke Can you do it? please

Edited by ReXXuZ
Link to comment
11 minutes ago, ReXXuZ said:

I want  out of the wings of the smoke 

function hydrasm( player )
if isPedInVehicle (player) then
local veh = getPedOccupiedVehicle(player)
local id = getElementModel ( veh )
if id == 520 then
local x,y,z = getElementPosition(player)
local smoke = createObject(2780, x, y, z)
local smoke2 = createObject(2780, x, y, z)
setElementCollisionsEnabled (smoke, false)
setElementCollisionsEnabled (smoke2, false)
attachElements(smoke, veh,5,-1,-1)
attachElements(smoke2, veh,-5,-1,-1) 
setElementAlpha(smoke, 0)
setElementAlpha(smoke2, 0)
       end
    end
end
addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )

 

function hydrasm( player )
if isPedInVehicle (player) then
local veh = getPedOccupiedVehicle(player)
local id = getElementModel ( veh )
if id == 520 then
addEventHandler ( "onVehicleExit", root, destroy )
local x,y,z = getElementPosition(player)
local smoke = createObject(2780, x, y, z)
local smoke2 = createObject(2780, x, y, z)
setElementCollisionsEnabled (smoke, false)
setElementCollisionsEnabled (smoke2, false)
attachElements(smoke, veh,+2,0,0)
attachElements(smoke2, veh,-2,0,0) 
       end
    end
end
addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )

function destroy()
    local smokes = getAttachedElements(source)
    for i,v in ipairs (smokes) do
        detachElements (v, source)
		destroyElement(v)
    end
end

 

Link to comment
1 hour ago, <~KaMiKaZe~> said:

function hydrasm( player )
if isPedInVehicle (player) then
local veh = getPedOccupiedVehicle(player)
local id = getElementModel ( veh )
if id == 520 then
local x,y,z = getElementPosition(player)
local smoke = createObject(2780, x, y, z)
local smoke2 = createObject(2780, x, y, z)
setElementCollisionsEnabled (smoke, false)
setElementCollisionsEnabled (smoke2, false)
attachElements(smoke, veh,5,-1,-1)
attachElements(smoke2, veh,-5,-1,-1) 
setElementAlpha(smoke, 0)
setElementAlpha(smoke2, 0)
       end
    end
end
addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )

 

you finally get a bindkey

Link to comment
6 minutes ago, ReXXuZ said:

you finally get a bindkey

function hydrasm( player )
if isPedInVehicle (player) then
addEventHandler ( "onVehicleExit", root, destroy )
local veh = getPedOccupiedVehicle(player)
local id = getElementModel ( veh )
if id == 520 then
local x,y,z = getElementPosition(player)
local smoke = createObject(2780, x, y, z)
local smoke2 = createObject(2780, x, y, z)
setElementCollisionsEnabled (smoke, false)
setElementCollisionsEnabled (smoke2, false)
attachElements(smoke, veh,5,-1,-1)
attachElements(smoke2, veh,-5,-1,-1) 
setElementAlpha(smoke, 0)
setElementAlpha(smoke2, 0)
       end
    end
end
--addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )


function destroy()
    local smokes = getAttachedElements(source)
    for i,v in ipairs (smokes) do
        detachElements (v, source)
		destroyElement(v)
    end
end

function bind( player )
  bindKey ( player, "H", "down", hydrasm )   -- bind the player's F1 down key-- bind the player's fire down and up control
end
addEventHandler ( "onVehicleEnter", getRootElement(), bind )

 

Link to comment
1 hour ago, <~KaMiKaZe~> said:

function hydrasm( player )
if isPedInVehicle (player) then
addEventHandler ( "onVehicleExit", root, destroy )
local veh = getPedOccupiedVehicle(player)
local id = getElementModel ( veh )
if id == 520 then
local x,y,z = getElementPosition(player)
local smoke = createObject(2780, x, y, z)
local smoke2 = createObject(2780, x, y, z)
setElementCollisionsEnabled (smoke, false)
setElementCollisionsEnabled (smoke2, false)
attachElements(smoke, veh,5,-1,-1)
attachElements(smoke2, veh,-5,-1,-1) 
setElementAlpha(smoke, 0)
setElementAlpha(smoke2, 0)
       end
    end
end
--addEventHandler ( "onVehicleEnter", getRootElement(), hydrasm )


function destroy()
    local smokes = getAttachedElements(source)
    for i,v in ipairs (smokes) do
        detachElements (v, source)
		destroyElement(v)
    end
end

function bind( player )
  bindKey ( player, "H", "down", hydrasm )   -- bind the player's F1 down key-- bind the player's fire down and up control
end
addEventHandler ( "onVehicleEnter", getRootElement(), bind )

 

the key opens but does not close again

Link to comment
  • 1 year later...
  • IIYAMA locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...