Jump to content

Search the Community

Showing results for tags 'hydra'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 11 results

  1. Herkese merhaba, bu benim ilk başlığım ve bu betiğe ihtiyacım var ama hiçbir yerde bulamadım. https://youtu.be/3lW2ZCuUE4g
  2. se alguem souber que me ajude a encontra o script dessa mira
  3. Can someone help me? what script used in this lock on fire hydra missiles
  4. There are two missiles that come from the sides of the hydra, I need that the missiles come together but I do not know how to do that by editing rotation or velocity. when I try, it deviate There is really no need to publish the code, I just want to know how to get the two missiles together without it deviating I hope someone helps me please
  5. When you press handbrake it should draw the image named 'crosshair.png' on the target, but this does not happen. What can be the error? The debugscript 3 does not output any errors Here's the code : local SHOOT_COOLDOWN = 5000 --Cooldown between homing shots local LOCKON_TIME = 100 --Time required to lock on to a target local LOCK_RANGE = 330 --Maximum distance between you and the target local LOCK_ANGLE = 0.95 --(in radians) We cannot lock on targets unless they are within this angle of the front of the hydra local VALID_TARGET_FUNCTION = function (vehicle) --Used to decide whether a vehicle should appear as a lock-on option -- local targetTeam = vehicle.controller and vehicle.controller.team -- local ourTeam = localPlayer.team -- if targetTeam and ourTeam and targetTeam == ourTeam then -- return false --The target vehicle has someone driving, and both of you are on the same team -- end return true end local validTarget = VALID_TARGET_FUNCTION or function() return true end LOCK_ANGLE = math.cos(LOCK_ANGLE) local inHydra = false local firestate = nil local visibleVehicle = {} local targetVehicle = nil local nearbyVehicles = {} getNearbyVehicles = function() return nearbyVehicles end --Used by other files local currentHydra = nil local function getTarget() -- Look for the nearest targets and lock on local nearestVehicle = nil local shortestDistance = LOCK_RANGE for _, vehicle in ipairs(nearbyVehicles) do local targPos = vehicle.position local myPos = localPlayer.position local displacement = targPos-myPos local dist = displacement.length if vehicle ~= localPlayer.vehicle and dist < shortestDistance then shortestDistance = dist nearestVehicle = vehicle end end return nearestVehicle end local function checkForLockout(vehicle) if visibleVehicle[vehicle] then visibleVehicle[vehicle] = nil lockedVehicle = nil targetVehicle = nil end end local lastShot = SHOOT_COOLDOWN*-2 local function shootMissile() if not inHydra then return end local target = lockedVehicle if not target or getTickCount() < lastShot + SHOOT_COOLDOWN then return end lastShot = getTickCount() local hydra = localPlayer.vehicle -- Shoot missile createProjectile( hydra, 20, hydra.position, 5000, target, _, _, _, hydra.velocity*1.2) lockedVehicle = nil targetVehicle = nil visibleVehicle[target] = nil end local function update() local curtime = getTickCount() local vehicle = targetVehicle if not vehicle then return end local visibleNow = false if vehicle ~= localPlayer.vehicle and not vehicle.blown and validTarget(vehicle) then local targPos = vehicle.position local myPos = localPlayer.position local displacement = targPos-myPos local dist = displacement.length local cosAngle = localPlayer.vehicle.matrix.forward:dot(displacement)/dist if dist < LOCK_RANGE and cosAngle>LOCK_ANGLE and firestate then local aX, aY = getScreenFromWorldPosition(targPos) if (aX and aY) then visibleNow = true if lockedVehicle == vehicle then dxDrawImage (aX-118,aY-118, 246, 246, 'crosshair.png',0,0,0,tocolor (255,0,0,255)) else dxDrawImage (aX-118, aY-118, 246, 246, 'crosshair.png',0,0,0,tocolor (255,255,255,255)) end end end end if not visibleNow then checkForLockout() elseif visibleVehicle[vehicle] then if curtime - visibleVehicle[vehicle] > LOCKON_TIME then lockedVehicle = vehicle end else visibleVehicle[vehicle] = curtime end end local function homingState(key,state) if not inHydra then return end if state == "down" then targetVehicle = getTarget() firestate = isControlEnabled("vehicle_secondary_fire") toggleControl("vehicle_secondary_fire",false) bindKey("vehicle_secondary_fire","down",shootMissile) else targetVehicle = nil lockedVehicle = nil toggleControl("vehicle_secondary_fire",firestate) firestate = nil unbindKey("vehicle_secondary_fire","down",shootMissile) end end local function vehicleGoneHandler() removeEventHandler("onClientElementDestroy", source, vehicleGoneHandler) removeEventHandler("onClientElementStreamOut", source, vehicleGoneHandler) if getElementType( source ) == "vehicle" then for i, v in ipairs(nearbyVehicles) do if v == source then checkForLockout(source) table.remove(nearbyVehicles, i) return end end end end local function prepAfterStreamIn(vehicle) addEventHandler("onClientElementStreamOut", vehicle, vehicleGoneHandler) addEventHandler("onClientElementDestroy", vehicle, vehicleGoneHandler) end local function streamInHandler() if getElementType( source ) == "vehicle" then table.insert(nearbyVehicles, source) prepAfterStreamIn(source) end end local function startHydra(vehicle) if not inHydra and vehicle and isElement(vehicle) and vehicle.model == 520 then nearbyVehicles = getElementsByType("vehicle", root, true) for i, v in ipairs(nearbyVehicles) do prepAfterStreamIn(v) end addEventHandler("onClientElementStreamIn", root, streamInHandler) addEventHandler("onClientVehicleExplode", vehicle, stopHydra) addEventHandler("onClientElementDestroy", vehicle, stopHydra) addEventHandler("onClientElementStreamOut", vehicle, stopHydra) inHydra = isControlEnabled("handbrake") currentHydra = vehicle toggleControl("handbrake", false) bindKey("handbrake","down",homingState) bindKey("handbrake","up",homingState) addEventHandler( "onClientRender", root, update) end end function stopHydra() if inHydra then local target = getTarget() for i, v in ipairs(nearbyVehicles) do if v ~= target then removeEventHandler("onClientElementDestroy", v, vehicleGoneHandler) removeEventHandler("onClientElementStreamOut", v, vehicleGoneHandler) checkForLockout(v) end end checkForLockout(target) if target then removeEventHandler("onClientElementDestroy", target, vehicleGoneHandler) removeEventHandler("onClientElementStreamOut", target, vehicleGoneHandler) end removeEventHandler("onClientRender", root, update) unbindKey("handbrake","down",homingState) unbindKey("handbrake","up",homingState) if firestate ~= nil then homingState("handbrake","up") end local vehicle = currentHydra currentHydra = nil toggleControl("handbrake", inHydra) inHydra = false removeEventHandler("onClientElementStreamIn", root, streamInHandler) if isElement(vehicle) then removeEventHandler("onClientVehicleExplode", vehicle, stopHydra) removeEventHandler("onClientElementDestroy", vehicle, stopHydra) removeEventHandler("onClientElementStreamOut", vehicle, stopHydra) end end end local function initScript() if localPlayer.vehicle and localPlayer.vehicle.model == 520 then startHydra(localPlayer.vehicle) end addEventHandler("onClientResourceStop", resourceRoot, stopHydra) addEventHandler("onClientPlayerVehicleExit",localPlayer,stopHydra) addEventHandler("onClientPlayerWasted",localPlayer,stopHydra) addEventHandler("onClientPlayerVehicleEnter",localPlayer,startHydra) end addEventHandler("onClientResourceStart",resourceRoot,initScript)
  6. When you press handbrake it should draw the image named 'crosshair.png' on the target, but this does not happen. What can be the error? The debugscript 3 does not output any errors Here's the code : local SHOOT_COOLDOWN = 5000 --Cooldown between homing shots local LOCKON_TIME = 100 --Time required to lock on to a target local LOCK_RANGE = 330 --Maximum distance between you and the target local LOCK_ANGLE = 0.95 --(in radians) We cannot lock on targets unless they are within this angle of the front of the hydra local VALID_TARGET_FUNCTION = function (vehicle) --Used to decide whether a vehicle should appear as a lock-on option -- local targetTeam = vehicle.controller and vehicle.controller.team -- local ourTeam = localPlayer.team -- if targetTeam and ourTeam and targetTeam == ourTeam then -- return false --The target vehicle has someone driving, and both of you are on the same team -- end return true end local validTarget = VALID_TARGET_FUNCTION or function() return true end LOCK_ANGLE = math.cos(LOCK_ANGLE) local inHydra = false local firestate = nil local visibleVehicle = {} local targetVehicle = nil local nearbyVehicles = {} getNearbyVehicles = function() return nearbyVehicles end --Used by other files local currentHydra = nil local function getTarget() -- Look for the nearest targets and lock on local nearestVehicle = nil local shortestDistance = LOCK_RANGE for _, vehicle in ipairs(nearbyVehicles) do local targPos = vehicle.position local myPos = localPlayer.position local displacement = targPos-myPos local dist = displacement.length if vehicle ~= localPlayer.vehicle and dist < shortestDistance then shortestDistance = dist nearestVehicle = vehicle end end return nearestVehicle end local function checkForLockout(vehicle) if visibleVehicle[vehicle] then visibleVehicle[vehicle] = nil lockedVehicle = nil targetVehicle = nil end end local lastShot = SHOOT_COOLDOWN*-2 local function shootMissile() if not inHydra then return end local target = lockedVehicle if not target or getTickCount() < lastShot + SHOOT_COOLDOWN then return end lastShot = getTickCount() local hydra = localPlayer.vehicle -- Shoot missile createProjectile( hydra, 20, hydra.position, 5000, target, _, _, _, hydra.velocity*1.2) lockedVehicle = nil targetVehicle = nil visibleVehicle[target] = nil end local function update() local curtime = getTickCount() local vehicle = targetVehicle if not vehicle then return end local visibleNow = false if vehicle ~= localPlayer.vehicle and not vehicle.blown and validTarget(vehicle) then local targPos = vehicle.position local myPos = localPlayer.position local displacement = targPos-myPos local dist = displacement.length local cosAngle = localPlayer.vehicle.matrix.forward:dot(displacement)/dist if dist < LOCK_RANGE and cosAngle>LOCK_ANGLE and firestate then local aX, aY = getScreenFromWorldPosition(targPos) if (aX and aY) then visibleNow = true if lockedVehicle == vehicle then dxDrawImage (aX-118,aY-118, 246, 246, 'crosshair.png',0,0,0,tocolor (255,0,0,255)) else dxDrawImage (aX-118, aY-118, 246, 246, 'crosshair.png',0,0,0,tocolor (255,255,255,255)) end end end end if not visibleNow then checkForLockout() elseif visibleVehicle[vehicle] then if curtime - visibleVehicle[vehicle] > LOCKON_TIME then lockedVehicle = vehicle end else visibleVehicle[vehicle] = curtime end end local function homingState(key,state) if not inHydra then return end if state == "down" then targetVehicle = getTarget() firestate = isControlEnabled("vehicle_secondary_fire") toggleControl("vehicle_secondary_fire",false) bindKey("vehicle_secondary_fire","down",shootMissile) else targetVehicle = nil lockedVehicle = nil toggleControl("vehicle_secondary_fire",firestate) firestate = nil unbindKey("vehicle_secondary_fire","down",shootMissile) end end local function vehicleGoneHandler() removeEventHandler("onClientElementDestroy", source, vehicleGoneHandler) removeEventHandler("onClientElementStreamOut", source, vehicleGoneHandler) if getElementType( source ) == "vehicle" then for i, v in ipairs(nearbyVehicles) do if v == source then checkForLockout(source) table.remove(nearbyVehicles, i) return end end end end local function prepAfterStreamIn(vehicle) addEventHandler("onClientElementStreamOut", vehicle, vehicleGoneHandler) addEventHandler("onClientElementDestroy", vehicle, vehicleGoneHandler) end local function streamInHandler() if getElementType( source ) == "vehicle" then table.insert(nearbyVehicles, source) prepAfterStreamIn(source) end end local function startHydra(vehicle) if not inHydra and vehicle and isElement(vehicle) and vehicle.model == 520 then nearbyVehicles = getElementsByType("vehicle", root, true) for i, v in ipairs(nearbyVehicles) do prepAfterStreamIn(v) end addEventHandler("onClientElementStreamIn", root, streamInHandler) addEventHandler("onClientVehicleExplode", vehicle, stopHydra) addEventHandler("onClientElementDestroy", vehicle, stopHydra) addEventHandler("onClientElementStreamOut", vehicle, stopHydra) inHydra = isControlEnabled("handbrake") currentHydra = vehicle toggleControl("handbrake", false) bindKey("handbrake","down",homingState) bindKey("handbrake","up",homingState) addEventHandler( "onClientRender", root, update) end end function stopHydra() if inHydra then local target = getTarget() for i, v in ipairs(nearbyVehicles) do if v ~= target then removeEventHandler("onClientElementDestroy", v, vehicleGoneHandler) removeEventHandler("onClientElementStreamOut", v, vehicleGoneHandler) checkForLockout(v) end end checkForLockout(target) if target then removeEventHandler("onClientElementDestroy", target, vehicleGoneHandler) removeEventHandler("onClientElementStreamOut", target, vehicleGoneHandler) end removeEventHandler("onClientRender", root, update) unbindKey("handbrake","down",homingState) unbindKey("handbrake","up",homingState) if firestate ~= nil then homingState("handbrake","up") end local vehicle = currentHydra currentHydra = nil toggleControl("handbrake", inHydra) inHydra = false removeEventHandler("onClientElementStreamIn", root, streamInHandler) if isElement(vehicle) then removeEventHandler("onClientVehicleExplode", vehicle, stopHydra) removeEventHandler("onClientElementDestroy", vehicle, stopHydra) removeEventHandler("onClientElementStreamOut", vehicle, stopHydra) end end end local function initScript() if localPlayer.vehicle and localPlayer.vehicle.model == 520 then startHydra(localPlayer.vehicle) end addEventHandler("onClientResourceStop", resourceRoot, stopHydra) addEventHandler("onClientPlayerVehicleExit",localPlayer,stopHydra) addEventHandler("onClientPlayerWasted",localPlayer,stopHydra) addEventHandler("onClientPlayerVehicleEnter",localPlayer,startHydra) end addEventHandler("onClientResourceStart",resourceRoot,initScript)
  7. I've got no idea if you guys are good enough to start building a community from zero, making scripts anything about aircrafts, building maps and etc. From now on the time, I am building a new huge community with the fellow ex-pilots that used to fly in CIT2 or other big servers are now just merged in a community. I'm lookin' for good designers and good developers can help me on developing stuff, etc. I hope you guys some of you interested in being a part of this journey and if you're, please DM me so fast because I really need to start developing my server right now, also the developers I'm gonna hire will be the paid developers which means we're gonna pay to Developers depending on how they did their job, good luck to anyone who would like to be a part of our community.
  8. Tron

    Hydra System

    Hello out there , I tried alot to fix out the hydra damage system but it didnt work. All i want to change is the damage script of hydra . When you shoot someone in hydra with a lock on shot i want it so that the missiles lower the victim's hp by around 25% per shot. I would be glad incase if anyone want to help me out of this. Thanks
  9. I just download this script and i have a stupid problem with this... It's do a DMG but not to players.. https://community.multitheftauto.com/index.php?p=resources&s=details&id=12320 ---------------------------------------------------- Sorry for my English i just from Poland...
  10. UPDATE: This resource is now on version 1.1 This update includes: * Hydra targetting actions now trigger MTA events. * Only rendered vehicles are considered, making it scale much better on larger servers. * Many bugs fixed (Such as errors spawning from a hydra being deleted via "destroyElement" * The coloured boxes around the targets are now optional, and can be customized. * A new feature called "focus" to show what the events triggered can be used for. * Better colour choices. New demo video is here: ========================================== The creator of this bug report (https://bugs.mtasa.com/view.php?id=9763) gave me some good reasons why MTA's default Hydra missile targetting system needs to be redone. * GTA was not made for multiplayer, so bugs like the one he filed are present in the default targetting system * It is not flexible, the server cannot change parameters such as lock-on time, angle of detection, range, cooldown etc. * You cannot have team tagging, which would be a great feature. Don't you hate it when you're holding space your own clan mates get targetted? * You cannot cycle through possible targets. The game decides which target you locked on to, and you can't change it unless you move around and do random stuff. So, I decided to implement a custom Hydra targetting system with all these features, with help from Antix. (Thanks to Edeen, Slim, Meex, Ease and Khid for testing the script) This is a drop in replacement for GTA's default missile targetting system, and only adds a few features (that can be nerfed) while remaining faithful to the original mechanics. The resource is free (MIT License) and you can use it on your server if you want. Download it and read the instructions for customizing it here: https://github.com/Luca-spopo/better-hydra-missiles Once it gets used by enough servers and tested enough, maybe we can include this in the default resources as a replacement for the current hydra/hunter missile system.
  11. Hello there, I've been having some trouble with the DestroyElement function. (destroyHydraGun function, line 42-51) The rest of the script works fine. An uzi is created when a player enters a Hydra, but it doesn't seem to destroy the uzi when a player exits the vehicle. What am I doing wrong? function hydraFunctions() -- ignore this function local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then outputChatBox ("Hydra guns installed") toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) toggleControl ( "vehicle_secondary_fire", false ) toggleControl ( "vehicle_fire", false ) setControlState ( "special_control_up", true) toggleControl ( "special_control_down", false) local x, y, z = getElementPosition(vehicle) local weapon = createWeapon("uzi", x, y, z) attachElements ( weapon, vehicle, 0, 4, 1, 0, 0, 90) end end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), hydraFunctions ) function hydraFiring() -- ignore this function local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then setWeaponClipAmmo(weapon, 500) setWeaponFiringRate(weapon, 90) setWeaponState(weapon, "firing") outputChatBox ("guns activated") end end end function hydraStopping() -- ignore this function local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then setWeaponState(weapon, "ready") outputChatBox ("guns deactivated") end end end function destroyHydraGun -- This function doesn't work local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then local attached = getElementAttachedTo (vehicle) if ( attached ) then destroyElement ( weapon ) end end addEventHandler("onClientPlayerVehicleExit", getLocalPlayer(), destroyHydraGun ) bindKey("mouse1", "down", hydraFiring) bindKey("mouse1", "up", hydraStopping) bindKey("lctrl", "down", hydraFiring) bindKey("lctrl", "up", hydraStopping)
×
×
  • Create New...