Fishing (ESX)
Last updated
Last updated
ESX/QBCore: This script requires purchase of either the ESX or QBCore version.
This script adds the ability to fish in any body of water, on your ESX server! Simply provide players with a way of obtaining a fishing rod item (add it to a shop, for example). Players can then use their fishing rod when facing water to start fishing. The player will perform a fishing animation with a visible fishing rod in their hand and periodically have a chance for a fish to bite. When the fish bites, the player must perform a skill check to catch the fish, which adds the species of fish to their inventory. These fish can be sold at the fish market for money.
By default, the Config.CommonFish species (carp) cannot be sold and is caught when a random chance generator is not successful to obtain a better species. If you would like this fish to be sold as well, simply add it to the Config.Fish table, with the chance as 100 and price as whatever you desire. Use the config.lua file to change the rod item name, chance to catch each fish, timing of the skill check, species of fish available, fish market info, etc. All display text can be customized in locales/en.lua or whatever language you are using.
Upload the script to your server's "resources" folder (or any [sub_directory])
Configure settings to your needs in config.lua
Execute dam_fishing.sql
on your database, or manually add the rod item and fish species you set in config.lua
Ensure the script is starting in your server.cfg
Use the fishing rod item when facing any body of water, to start fishing. Press E at the right time to catch a fish. Sell fish at the fish market.
Config = Config or {}
Config.OldESX = false -- Uses the old esx:getSharedObject event if true, or the new export if false | Default: false
Config.Locale = GetConvar("esx:locale", "en") -- Language file using esx:locale, defaulting to "en" | Default: GetConvar("esx:locale", "en")
Config.CatchChance = 25 -- Chance (%) of a fish biting, every 5 seconds | Default: 25
Config.RodItem = "fishing_rod" -- Fishing rod item name | Defalt: "fishing_rod"
Config.CommonFish = "carp" -- Junk fish name, given if the RNG (1-100) is outside the range of all other fish chances | Defalt: "carp"
Config.SkillbarTime = 2000 -- Time it takes the skillbar to go from 0-100% (in ms) | Default: 2000
Config.Fish = { -- Types of fish you can catch
["trout"] = { chance = 80, price = 100 }, -- A fish type (key = item name, value = a table with chance as 1-100 (%) and price as sale value)
["bass"] = { chance = 55, price = 150 },
["whiting"] = { chance = 40, price = 200 },
["salmon"] = { chance = 20, price = 300 },
["squid"] = { chance = 5, price = 400 },
}
Config.Marketplace = {
Label = "Fish Market", -- Label for the fish market (blip label and sales menu header) | Default: "Fish Market"
Pos = vector3(-1039.63, -1396.79, 4.55), -- Coordinates (vector3) of the fish market
Marker = {
Show = true, -- Enable marker | Default: true
Type = 1, -- Marker type | Default: 1
Distance = 100.0, -- Marker draw distance | Default: 100.0
Radius = 2.5, -- Marker interact radius. If the marker's a circle, this should be the same value as Size.x | Default: 2.5
Size = { x = 2.5, y = 2.5, z = 0.25 }, -- Marker size (xyz table). If the marker's a circle, x should be the same value as Radius
Colour = { r = 255, g = 255, b = 255, a = 180 } -- Marker colour (rgba table)
},
Blip = {
Show = true, -- Enable map blip | Default: true
Sprite = 68, -- Blip sprite/type | Default: 68
Display = 4, -- Blip display type | Default: 4
Scale = 1.0, -- Blip scale/size | Default: 1.0
Colour = 38 -- Blip colour | Default: 38
}
}
Config.Notify = function(msg, type, time) -- Custom notification function (client side)
-- exports.mythic_notify:SendAlert(type, msg, time)
ESX.ShowNotification(msg, type, time)
end
Code is accessible
No
Subscription-based
No
Lines (approximately)
~200
Requirements
ESX
Support
Yes