Ability
Ability
is a global enum that represents the different abilities in JC4MP, such as the grappling hook, wingsuit, etc.
Ability | Description |
---|---|
Ability.Tether | Allows the player to connect two objects or players together with the grapplehook. |
Ability.RetractTether | Allows the player to pull tethered objects or players towards each other. |
Ability.Wingsuit | Allows the player to use the wingsuit. |
Ability.PlantedExplosives | Allows placement of explosives that can be detonated remotely. |
Ability.Parachute | Allows the player to use the parachute. |
Ability.ParachuteSlingshot | Allows the player to use the grapplehook while parachuting. |
Ability.GrapplingHook | Controls whether or not the grappling hook is enabled. |
Ability.Hammer | Allows the player to use the grapplehook melee ability. |
Ability.MultiplePlantedExplosives | Enables placement of multiple explosives simultaneously. |
Ability.Grenades | Allows the player to use grenades. |
Ability.ExitVehicle | Allows the player to quickly exit any vehicle. |
Example of enabling the local player's ability to use the wingsuit:
Event.Add("ResourceStart", function(name)
local localPlayer = Players.Local():GetGamePlayer()
localPlayer:EnableAbility(Ability.Wingsuit)
end)
Make sure to enable abilities once the resource has loaded. In this example, it's using the ResourceStart
event to ensure that the resource has fully loaded before enabling the ability. If the ability were enabled outside of this event, it might not trigger properly right when a player joins the server.