-
Posts
22 -
Joined
-
Last visited
#MacTavish's Achievements

Civilian (7/54)
4
Reputation
-
Grand_merreda started following #MacTavish
-
@IIYAMAthank you so much, it works good ! Here is the code, maybe you want to see. Thank you ! function shootMissiles() thePilot = getLocalPlayer() theVehicle = getPedOccupiedVehicle(thePilot) if theVehicle and getElementType(theVehicle) == 'vehicle' then theVehicleModel = getElementModel(theVehicle) if theVehicleModel == 519 then local x1, y1, z1 = getPositionFromElementOffset(theVehicle, -3, 3.5, 0) local x2, y2, z2 = getPositionFromElementOffset(theVehicle, 3, 3.5, 0) missileLeft = createProjectile(theVehicle, 19, x1, y1, z1) missileRight = createProjectile(theVehicle, 19, x2, y2, z2) end end end bindKey("lctrl", "down", shootMissiles) function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] 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 end
-
Okay, i will try to do it. If it works, i will notify you, thank you
-
i tried to solve it by using func that you told me. But i couldn't do it, i didn't understood how can i use this exactly ? function shootMissiles() thePilot = getLocalPlayer() theVehicle = getPedOccupiedVehicle(thePilot) if theVehicle and getElementType(theVehicle) == 'vehicle' then theVehicleModel = getElementModel(theVehicle) if theVehicleModel == 519 then local x, y, z = getElementPosition(theVehicle) local rotX, rotY, rotZ = getElementRotation(theVehicle) local matrix = getElementMatrix(theVehicle) local offX = 0 * matrix[1][1] + 1 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1] local offY = 0 * matrix[1][2] + 1 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2] local offZ = 0 * matrix[1][3] + 1 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3] local vx = offX - x local vy = offY - y local vz = offZ - z x = 0 * matrix[1][1] + 3 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1] y = 0 * matrix[1][2] + 3 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2] z = 0 * matrix[1][3] + 3 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3] missileLeft = createProjectile(theVehicle, 19,x+2,y,z, 200, nil, 0, 0, 360 - rotZ, vx, vy, vz) missileRight = createProjectile(theVehicle, 19,x-2,y,z, 200, nil, 0, 0, 360 - rotZ, vx, vy, vz) end end end bindKey("lctrl", "down", shootMissiles)
-
Hi all, im trying to add missile launchers on shamal plane right and left wings. I added them and i can fire them, no problem till this point. But there is a problem when i turn the plane 90 degree, missiles overlaps each others. I tried to explain it by image : https://prnt.sc/uknal0 What should i do ? Please help me. function shootMissiles() thePilot = getLocalPlayer() theVehicle = getPedOccupiedVehicle(thePilot) if theVehicle and getElementType(theVehicle) == 'vehicle' then theVehicleModel = getElementModel(theVehicle) if theVehicleModel == 519 then local x, y, z = getElementPosition(theVehicle) local rotX, rotY, rotZ = getElementRotation(thePilot) missileLeft = createProjectile(theVehicle, 19, x, y, z) missileRight = createProjectile(theVehicle, 19, x, y, z) attachElements ( missileLeft, theVehicle, -3, 3.5, 0, 0, 30, 90, 1.0, nil, rotX, rotY, rotZ) attachElements ( missileRight, theVehicle, 3, 3.5, 0, 0, 30, 90, 1.0, nil, rotX, rotY, rotZ) end end end bindKey("lctrl", "down", shootMissiles)
-
hi all, i created a script that works for shooting other vehicles with heatseeking rockets by Hunter Helicopter. But i can shoot other vehicles if they are on my screen, so i can shoot other vehicles even they are behind of hunter helicopter and this is unrealistic. I want to make it realistic, so, i want to shoot other vehicles if they are only on Helicopters' perspective even when i don't look at them, here is the script, please help ; function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getElementModel(vehicle) == 425 then local x, y, z = getElementPosition(getLocalPlayer()) local vehicles = getElementsWithinRange(x, y, z, 300, "vehicle") local target = vehicles[1] ~= vehicle and vehicles[1] or vehicles[2] if target and isElementOnScreen(target) then createProjectile(vehicle, 20, x, y, z, 1, target) end end end bindKey( "lshift", "down", shootProjectile)
-
If you have this source can u share it with me please im looking for it long time
-
Hi all, i want to fly with SeaSparrow helicopter flexible as Hunter Helicopter (because Hunter helictoper can flip around itself and move fastly) , so i tried to set Hunters' handling settings on SeaSparrow heli. But it doesn't work (i got any error btw), help please, thanks, here is the script; function getModelHandling( element, property ) if isElement ( element ) and getElementsByType ( element ) == "vehicle" and type ( property ) == "string" then local SparrowID = 447 local modelID = 425 local handlingTable = getModelHandling ( modelID ) local value = handlingTable[property] if value then for k,_ in pairs(value(modelID)) do setModelHandling(447, k, value) end end end return false end
-
Hi all, i have a question about modelling. I have a vehicle model' dff and txd files. Is it possible to create .col file by using these dff and txd files? If its possible then how? Thank you
-
#MacTavish started following Zorgman
-
Adding Heat-Seeking Missile to Hunter Helicopter
#MacTavish replied to #MacTavish's topic in Scripting
Im really thankful to you Bilal135, you are really helpful and good person ! Thank you -
#MacTavish started following Captain Cody
-
Adding Heat-Seeking Missile to Hunter Helicopter
#MacTavish replied to #MacTavish's topic in Scripting
Thank you so much Bilal135, i tried your script but i got debug in 17th line 6th argument (it says got table). I created another script with some help that works really good, here is the script if you want to use ; function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getElementModel(vehicle) == 425 then local x, y, z = getElementPosition(getLocalPlayer()) local vehicles = getElementsWithinRange(x, y, z, 300, "vehicle") local target = vehicles[1] ~= vehicle and vehicles[1] or vehicles[2] if target then createProjectile(vehicle, 20, x, y, z, 1, target) end end end bindKey( "lshift", "down", shootProjectile) Btw i don't understand what are they for [1] and [2], what does they mean? can you explain me please if you know, thanks -
#MacTavish started following IIYAMA
-
Adding Heat-Seeking Missile to Hunter Helicopter
#MacTavish replied to #MacTavish's topic in Scripting
hey all, can somebody help me , i want to fire heat-seeking missile on a "target". I can fire heatseeking missile but can't lock it on a "target", please help, thanks function shootProjectile() local hunter = getPedOccupiedVehicle(localPlayer) if hunter and getElementModel(hunter) == 425 then local x, y, z = getElementPosition(hunter) createProjectile(hunter, 20, x, y, z, hedef) local hedef = getElementsWithinRange(x, y, z, 300, "vehicle") end end bindKey( "lshift", "down", shootProjectile) I almost forgot, HAPPY NEW YEAR btw ! -
Adding Heat-Seeking Missile to Hunter Helicopter
#MacTavish replied to #MacTavish's topic in Scripting
function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getElementModel(vehicle) == 425 then local target = getElementModel(targetvehicle) or nil local x, y, z = getElementPosition(vehicle) createProjectile(vehicle, 20, x, y, z, target) end end bindKey( "lshift", "down", shootProjectile) I scripted this , i can fire heatseeking missile from Hunter but... still can't lock on a target, what should i do.. thanks -
Adding Heat-Seeking Missile to Hunter Helicopter
#MacTavish replied to #MacTavish's topic in Scripting
Thank you again Bilal, i will try it and i will notify you