Jump to content

Hydra Flares


delta1337

Recommended Posts

Posted

Hello, so last time ive made a script for multiple flares for every Helicopter and Plane, but the problem is they dont work, if your firing out flares they are just nothing doing and the HSrocket will still hit me without a single problem, can somebody help me with making them work? 

- Server side

local timer= { }
local timer_object= {}
local move_object=  {}

addEventHandler('onPlayerJoin',root,function()
bindKey(source,'b','down',function(gracz)
if getPedOccupiedVehicle(gracz) and (getVehicleType(getPedOccupiedVehicle(gracz))=='Plane' or getVehicleType(getPedOccupiedVehicle(gracz))=='Helicopter') then
if isTimer(timer[gracz]) then return end
timer[gracz] = setTimer(function() end,3000,1)
local x,y,z = getElementPosition(gracz);
		local xr,yr,zr = getElementRotation(gracz);
		local offsetRot = math.rad(zr+90);
		local vx = x+1*math.cos(offsetRot);
		local vy = y+1*math.sin(offsetRot);
		local vrot = zr+90;
triggerClientEvent(root,'Zrzuc_RoadFire',root,vx, vy,x,y,z)
end
end)
end)

for _,v in pairs(getElementsByType('player')) do
bindKey(v,'b','down',function(gracz)
if getPedOccupiedVehicle(gracz) and (getVehicleType(getPedOccupiedVehicle(gracz))=='Plane' or getVehicleType(getPedOccupiedVehicle(gracz))=='Helicopter') then
if isTimer(timer[gracz]) then return end
timer[gracz] = setTimer(function() end,3000,1)
local x,y,z = getElementPosition(gracz);
		local xr,yr,zr = getElementRotation(gracz);
		local offsetRot = math.rad(zr+90);
		local vx = x+1*math.cos(offsetRot);
		local vy = y+1*math.sin(offsetRot);
		local vrot = zr+90;
triggerClientEvent(root,'Zrzuc_RoadFire',root,vx, vy,x,y,z)
end
end)
end
addEvent('Zrzuc_Delte',true)
addEventHandler('Zrzuc_Delte',root,function(rx,ry,x,y,z,rz)
for i=1,3 do
local object = createObject(354,rx,ry-i,rz-3)
setElementAlpha(object,0)
move_object[object] = setTimer(function(object,rx,ry,x,y,z,rz,i)
local los = math.random(0,1)
if los==1 then
moveObject(object,9000,rx+math.random(10,40),ry-i-math.random(1,6),z)
else
moveObject(object,9000,rx-math.random(10,40),ry-i-math.random(1,6),z)
end
end,50,1,object,rx,ry,x,y,z,rz,i)
timer_object[object] = setTimer(function(object)
destroyElement(object)
end,2000*2,1,object)
end
end)

Client side -

-- 354

addEvent('Zrzuc_RoadFire',true)
addEventHandler('Zrzuc_RoadFire',root,function(rx,ry,x,y,z)
local ground = getGroundPosition(x,y,z) 
triggerServerEvent('Zrzuc_Delte',root,rx,ry,x,y,ground,z)
end)

 

Posted

Thank you for the reply. Do you have any idea which code i need to use to make HSRPG hit the target? Cause ive searched it and i could not find it. :/ 

 

Posted
17 hours ago, delta1337 said:

Thank you for the reply. Do you have any idea which code i need to use to make HSRPG hit the target? Cause ive searched it and i could not find it. :/ 

 

Scripts link pls.

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...