Jump to content

Search the Community

Showing results for tags 'destroy weapon'.

  • 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 1 result

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