Jump to content

fire on/off power


Recommended Posts

Hi there i'm making this ghost rider script server side and i have trouble making the command fire off the fire shape got destroyed but the zone of burn didn't get destroyed help please :

 



function GrHabilit(Elemento)
if Elemento and getElementData(source,"colGr")   then
if getElementModel(Elemento) ~= 78 then
if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
setPedOnFire(Elemento,true)
elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
setElementHealth(Elemento, 200)
end
end
end
end
addEventHandler("onColShapeHit",getRootElement(),GrHabilit)

function fireon (source)
	
if getElementModel(source) == 78 then
        local x, y, z = getElementPosition (source)		
        Fogo[4] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ], x, y, z)
        setElementCollisionsEnabled(Fogo[4], false)
        exports.bone_attach:attachElementToBone (Fogo[4], source, 8, -0, 0, -0.3, -125, 0, 0)
        local zone1 = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
        attachElements(zone1,source,0,0,0)
        setElementData(zone1,"colGr",true)   -- to burn who ever get near him
        outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", source, 0, 255, 0, true )
    

end
end
addCommandHandler ("fireon", fireon)

function fireoff (source)

if getElementModel(source) == 78 then 
local x, y, z = getElementPosition (source)
local zone1 = getElementAttachedTo ( source )
if ( zone1 ~= false ) then      -- supposed to destroy the burn zone
destroyElement ( zone1 )               -- supposed to destroy the burn zone  	
destroyElement(Fogo[4])        --destroy the fire shape

outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", source, 0, 255, 0, true )
end
end
end
addCommandHandler ("fireoff", fireoff

please help ..

Link to comment
local zones = {}
function GrHabilit(Elemento)
if Elemento and getElementData(source,"colGr")   then
if getElementModel(Elemento) ~= 78 then
if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
setPedOnFire(Elemento,true)
elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
setElementHealth(Elemento, 200)
end
end
end
end
addEventHandler("onColShapeHit",getRootElement(),GrHabilit)

function fireon (thePlayer)
if getElementModel(thePlayer) == 78  then
        local x, y, z = getElementPosition (thePlayer)		
        Fogo[4] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ], x, y, z)
        setElementCollisionsEnabled(Fogo[4], false)
        exports.bone_attach:attachElementToBone (Fogo[4], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
        zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
        attachElements(zones[thePlayer],thePlayer,0,0,0)
        setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
        outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
end
end
addCommandHandler ("fireon", fireon)

function fireoff (player)
if getElementModel(player) == 78 then 
if ( zones[player] ~= false ) then      -- check if player has burn zone
destroyElement ( zones[player] )               -- destroy the burn zone  	
destroyElement(Fogo[4])        --destroy the fire shape
outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
end
end
end
addCommandHandler ("fireoff", fireoff)

i didn't test it , but try and if there problem tell me ^^ 

Link to comment
1 hour ago, Oussema said:

local zones = {}
function GrHabilit(Elemento)
if Elemento and getElementData(source,"colGr")   then
if getElementModel(Elemento) ~= 78 then
if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
setPedOnFire(Elemento,true)
elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
setElementHealth(Elemento, 200)
end
end
end
end
addEventHandler("onColShapeHit",getRootElement(),GrHabilit)

function fireon (thePlayer)
if getElementModel(thePlayer) == 78  then
        local x, y, z = getElementPosition (thePlayer)		
        Fogo[4] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ], x, y, z)
        setElementCollisionsEnabled(Fogo[4], false)
        exports.bone_attach:attachElementToBone (Fogo[4], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
        zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
        attachElements(zones[thePlayer],thePlayer,0,0,0)
        setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
        outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
end
end
addCommandHandler ("fireon", fireon)

function fireoff (player)
if getElementModel(player) == 78 then 
if ( zones[player] ~= false ) then      -- check if player has burn zone
destroyElement ( zones[player] )               -- destroy the burn zone  	
destroyElement(Fogo[4])        --destroy the fire shape
outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
end
end
end
addCommandHandler ("fireoff", fireoff)

i didn't test it , but try and if there problem tell me ^^ 

it doesn't burn any more i think it's because of this
 

if Elemento and getElementData(source,"colGr")   then--i think source is what make the proublem  

or this another zone in the script make his bike burn peds 
 

function IniciarFogoNaMoto(Ve,Assento)
if (Assento == 0) then
 if getElementModel(source) == 78 and getElementModel(Ve) == 463 and getElementData(source,"PLAYERGR") then
setVehicleDamageProof ( Ve, true )
 local Mx,My,Mz = getElementPosition(Ve)
	
Fogo[1] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ],Mx,My,Mz)
 Fogo[2] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ],Mx,My,Mz)
 Fogo[3] = createObject(TabeladeFogo[ math.random( 1,#TabeladeFogo ) ],Mx,My,Mz)
		setElementCollisionsEnabled(Fogo[1], false)
			setElementCollisionsEnabled(Fogo[2], false)
			setElementCollisionsEnabled(Fogo[3], false)
			attachElements(Fogo[3],Ve,0,1,0)
attachElements(Fogo[1],Ve,0,-1,0)
attachElements(Fogo[2],Ve,-0.3,0,0)
local zone = createColCuboid(Mx, My, Mz, 3.1827392578125, 3.8387451171875, 2.4195971488953)
attachElements(zone,Ve,0,0,0)
setElementData(zone,"colGr",true)-- here another zone

		end
	end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), IniciarFogoNaMoto)
			

 

Edited by DarkBeautyDZ
Link to comment
local zones = {}
local Fogo = {}
function GrHabilit(Elemento)
if Elemento and getElementData(source,"colGr") then
if getElementModel(Elemento) ~= 78 then
if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
setPedOnFire(Elemento,true)
elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
setElementHealth( Elemento, 200 )
setTimer( setVehicleDamageProof, 100, 1, Elemento, true )
end
end
end
end
addEventHandler("onColShapeHit",getRootElement(),GrHabilit)

function fireon (thePlayer)
if getElementModel(thePlayer) == 78  then
        local x, y, z = getElementPosition (thePlayer)		
       Fogo[thePlayer] = createObject( ObjectID, x, y, z )-- PUT HERE YOUR OBJECT ID ( objectID ).
        setElementCollisionsEnabled(Fogo[thePlayer], false)
        exports.bone_attach:attachElementToBone (Fogo[thePlayer], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
		setElementAlpha( Fogo[thePlayer], 0 )
        zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
        attachElements(zones[thePlayer],thePlayer,0,0,0)
        setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
        outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
end
end
addCommandHandler ("fireon", fireon)

function fireoff (player)
if getElementModel(player) == 78 then 
if ( zones[player] ~= false ) then      -- check if player has burn zone
destroyElement ( zones[player] )               -- destroy the burn zone  	
destroyElement(Fogo[player])        --destroy the fire shape
outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
end
end
end
addCommandHandler ("fireoff", fireoff)

 

Link to comment
56 minutes ago, <~KaMiKaZe~> said:

local zones = {}
local Fogo = {}
function GrHabilit(Elemento)
if Elemento and getElementData(source,"colGr") then
if getElementModel(Elemento) ~= 78 then
if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
setPedOnFire(Elemento,true)
elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
setElementHealth( Elemento, 200 )
setTimer( setVehicleDamageProof, 100, 1, Elemento, true )
end
end
end
end
addEventHandler("onColShapeHit",getRootElement(),GrHabilit)

function fireon (thePlayer)
if getElementModel(thePlayer) == 78  then
        local x, y, z = getElementPosition (thePlayer)		
       Fogo[thePlayer] = createObject( ObjectID, x, y, z )-- PUT HERE YOUR OBJECT ID ( objectID ).
        setElementCollisionsEnabled(Fogo[thePlayer], false)
        exports.bone_attach:attachElementToBone (Fogo[thePlayer], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
		setElementAlpha( Fogo[thePlayer], 0 )
        zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
        attachElements(zones[thePlayer],thePlayer,0,0,0)
        setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
        outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
end
end
addCommandHandler ("fireon", fireon)

function fireoff (player)
if getElementModel(player) == 78 then 
if ( zones[player] ~= false ) then      -- check if player has burn zone
destroyElement ( zones[player] )               -- destroy the burn zone  	
destroyElement(Fogo[player])        --destroy the fire shape
outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
end
end
end
addCommandHandler ("fireoff", fireoff)

 

the problem isn't in fogo it's in zones (burn zone doesn't disapair)

Link to comment

The zone disappears. This maybe happens because you spam the 'fireon' command. I did use an element detector for u can verify if this deduction is right. Or maybe can use 'showcol 1' command.

local zones = {}
local Fogo = {}
function GrHabilit(Elemento)
if Elemento and getElementData(source,"colGr") then
if getElementModel(Elemento) ~= 78 then
if getElementType(Elemento) == "player" or getElementType(Elemento) == "ped"  then
setPedOnFire(Elemento,true)
elseif getElementType(Elemento) == "vehicle" then --this to not blow his bike XD
setElementHealth( Elemento, 200 )
end
end
end
end
addEventHandler("onColShapeHit",getRootElement(),GrHabilit)

function fireon (thePlayer)
if getElementModel(thePlayer) == 78  then
        if not isElement(Fogo[thePlayer]) then
        local x, y, z = getElementPosition (thePlayer)		
        Fogo[thePlayer] = createObject( ObjectID, x, y, z )-- PUT HERE YOUR OBJECT ID ( objectID ).
        setElementCollisionsEnabled(Fogo[thePlayer], false)
        exports.bone_attach:attachElementToBone (Fogo[thePlayer], thePlayer, 8, -0, 0, -0.3, -125, 0, 0)
		setElementAlpha( Fogo[thePlayer], 0 )
        zones[thePlayer] = createColCuboid(x, y, z, 3.1827392578125, 3.8387451171875, 2.4195971488953)
        attachElements(zones[thePlayer],thePlayer,0,0,0)
        setElementData(zones[thePlayer],"colGr",true)   -- to burn who ever get near him
        outputChatBox ( "#FFFF00Power #00FF00Revenge Fire ON", thePlayer, 0, 255, 0, true )
		else 
		destroyElement(Fogo[thePlayer]) 
		destroyElement(zones[thePlayer])
	    setTimer( fireon, 100, 1, thePlayer )
		end
end
end
addCommandHandler ("fireon", fireon)

function fireoff (player)
if getElementModel(player) == 78 then 
if isElement(zones[thePlayer]) then   -- check if player has burn zone
destroyElement ( zones[player] )               -- destroy the burn zone  	
destroyElement(Fogo[player])        --destroy the fire shape
outputChatBox ( "#FFFF00Power #00FF00Revenge Fire OFF", player, 0, 255, 0, true )
end
end
end
addCommandHandler ("fireoff", fireoff)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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