Skip to content

Commit

Permalink
add wasabi_fishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Achim-Sommer committed Jun 13, 2023
1 parent 1e1034d commit b4dbaeb
Show file tree
Hide file tree
Showing 38 changed files with 940 additions and 1 deletion.
Binary file added ItemBilder/anchovy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ItemBilder/fishbait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ItemBilder/fishingrod.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ItemBilder/salmon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ItemBilder/trout.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ItemBilder/tuna.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion [extras]/fuksus-shops/config.lua
Expand Up @@ -102,9 +102,12 @@ Config.shops = {
{ type = 'tool', name = 'hose', description = 'Kann man immer gebrauchen', price = 10 },
{ type = 'tool', name = 'WEAPON_WRENCH', description = 'Kann nützlich werden', price = 200 },
{ type = 'tool', name = 'WEAPON_PETROLCAN', description = 'Falls der Tank leer geht', price = 150 },
{ type = 'angel', name = 'fishingrod', description = 'Wie wäre es mit Angeln?', price = 250 },
{ type = 'angel', name = 'fishbait', description = 'Ohne Köder wird es schwer einen Fisch zu fangen!', price = 50 },
},
filters = {
tool = 'Tools'
tool = 'Tools',
angel = 'Angelausrüstung'
},
locations = {
vec3(2748.0, 3473.0, 55.67),
Expand Down
42 changes: 42 additions & 0 deletions [extras]/wasabi_fishing/Inventory_Items/ESX/ox_inventory.txt
@@ -0,0 +1,42 @@
-- Place in ox_inventory/data/items.lua
['tuna'] = {
label = 'Tuna',
weight = 650,
stack = true,
close = false,
},

['salmon'] = {
label = 'Salmon',
weight = 350,
stack = true,
close = false,
},

['trout'] = {
label = 'Trout',
weight = 250,
stack = true,
close = false,
},

['anchovy'] = {
label = 'Anchovy',
weight = 50,
stack = true,
close = false,
},

['fishbait'] = {
label = 'Fish Bait',
weight = 50,
stack = true,
close = false,
},

['fishingrod'] = {
label = 'Fishing Rod',
weight = 800,
stack = true,
close = true,
},
@@ -0,0 +1,8 @@
INSERT INTO `items` (`name`, `label`, `limit`) VALUES
('fishingrod', 'Fishing Rod', 20),
('fishbait', 'Fish Bait', 20),
('anchovy', 'Anchovy', 20),
('trout', 'Trout', 20),
('salmon', 'Salmon', 20),
('tuna', 'Tuna', 40)
;
@@ -0,0 +1,8 @@
INSERT INTO `items` (`name`, `label`, `weight`) VALUES
('fishingrod', 'Fishing Rod', 20),
('fishbait', 'Fish Bait', 20),
('anchovy', 'Anchovy', 20),
('trout', 'Trout', 20),
('salmon', 'Salmon', 20),
('tuna', 'Tuna', 40)
;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions [extras]/wasabi_fishing/Inventory_Items/QBCore/items.txt
@@ -0,0 +1,7 @@
-- Add to qb-core/shared/items.lua
['fishingrod'] = {['name'] = 'fishingrod', ['label'] = 'Fishing Rod', ['weight'] = 250, ['type'] = 'item', ['image'] = 'fishingrod.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Use this with bait to catch fish.'},
['fishbait'] = {['name'] = 'fishbait', ['label'] = 'Fishing Bait', ['weight'] = 5, ['type'] = 'item', ['image'] = 'fishbait.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = true, ['description'] = 'With a fishing rod this can catch some fish.'},
['anchovy'] = {['name'] = 'anchovy', ['label'] = 'Anchovy', ['weight'] = 35, ['type'] = 'item', ['image'] = 'anchovy.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = true, ['description'] = 'A breed of fish.'},
['trout'] = {['name'] = 'trout', ['label'] = 'Trout', ['weight'] = 85, ['type'] = 'item', ['image'] = 'trout.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = true, ['description'] = 'A breed of fish.'},
['salmon'] = {['name'] = 'salmon', ['label'] = 'Salmon', ['weight'] = 125, ['type'] = 'item', ['image'] = 'salmon.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = true, ['description'] = 'A breed of fish.'},
['tuna'] = {['name'] = 'tuna', ['label'] = 'Tuna', ['weight'] = 225, ['type'] = 'item', ['image'] = 'tuna.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = true, ['description'] = 'A breed of fish.'},
42 changes: 42 additions & 0 deletions [extras]/wasabi_fishing/Inventory_Items/QBCore/ox_inventory.txt
@@ -0,0 +1,42 @@
-- Place in ox_inventory/data/items.lua
['tuna'] = {
label = 'Tuna',
weight = 650,
stack = true,
close = false,
},

['salmon'] = {
label = 'Salmon',
weight = 350,
stack = true,
close = false,
},

['trout'] = {
label = 'Trout',
weight = 250,
stack = true,
close = false,
},

['anchovy'] = {
label = 'Anchovy',
weight = 50,
stack = true,
close = false,
},

['fishbait'] = {
label = 'Fish Bait',
weight = 50,
stack = true,
close = false,
},

['fishingrod'] = {
label = 'Fishing Rod',
weight = 800,
stack = true,
close = true,
},
44 changes: 44 additions & 0 deletions [extras]/wasabi_fishing/README.md
@@ -0,0 +1,44 @@
# wasabi_fishing

This resource was created as a free interactive fishing script for ESX/QBCore servers.

## Features
- Out of the box compatible with ESX and QBCore
- Optimized 0.00ms usage on idle
- Skill-check based success
- Full animations and props
- Chance of fishing rod breaking upon failing skill-check(Can be changed in config)
- Configurable random wait time for getting bite on line
- Configurable fishing rewards(4 by default included)
- Configurable prices to sell fishing rewards
- Configurable skill-check difficulty per fishing reward
- Ability to fish from boat, pier, or anywhere with a body of water
- No job requirement
- Fully configurable fish buyer to sell fish

## Dependencies
- es_extended OR qb-core
- ox_lib - https://github.com/overextended/ox_lib/releases


## Installation

- Make sure you have dependencies

- Make sure items are added to server(Check `Inventory_Items` directory for images/examples

- Put script in your `resources` directory

- Add `ensure wasabi_fishing` in your `server.cfg` (*After* dependencies)

### Extra Information
- Make sure `ox_lib` starts before `wasabi_fishing`
- Inventory images included in the `Inventory_Items/InventoryImages` directory
- You must add the item `fishingrod` and `fishbait` to one of your in-game shops or have a place for your players to obtain.

## Preview
https://www.youtube.com/watch?v=kLLPGJIK3Q0


# Support
<a href='https://discord.gg/79zjvy4JMs'>![Discord Banner 2](https://discordapp.com/api/guilds/1025493337031049358/widget.png?style=banner2)</a>
65 changes: 65 additions & 0 deletions [extras]/wasabi_fishing/bridge/esx/client.lua
@@ -0,0 +1,65 @@
-----------------For support, scripts, and more----------------
--------------- https://discord.gg/wasabiscripts -------------
---------------------------------------------------------------
if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports['es_extended']:getSharedObject()
Framework, PlayerLoaded, PlayerData = 'esx', nil, {}

RegisterNetEvent('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
PlayerLoaded = true
end)

RegisterNetEvent('esx:onPlayerSpawn', function()
TriggerEvent('wasabi_bridge:onPlayerSpawn')
end)

AddEventHandler('esx:onPlayerDeath', function(data)
TriggerEvent('wasabi_bridge:onPlayerDeath')
end)

RegisterNetEvent('esx:onPlayerLogout', function()
table.wipe(PlayerData)
PlayerLoaded = false
end)

RegisterNetEvent('esx:setJob', function(job)
PlayerData.job = job
end)

AddEventHandler('onResourceStart', function(resourceName)
if GetCurrentResourceName() ~= resourceName or not ESX.PlayerLoaded then return end
PlayerData = ESX.GetPlayerData()
PlayerLoaded = true
end)

AddEventHandler('esx:setPlayerData', function(key, value)
if GetInvokingResource() ~= 'es_extended' then return end
PlayerData[key] = value
end)

function HasGroup(filter)
local type = type(filter)

if type == 'string' then
if PlayerData.job.name == filter then
return PlayerData.job.name, PlayerData.job.grade
end
else
local tabletype = table.type(filter)

if tabletype == 'hash' then
local grade = filter[PlayerData.job.name]

if grade and grade <= PlayerData.job.grade then
return PlayerData.job.name, PlayerData.job.grade
end
elseif tabletype == 'array' then
for i = 1, #filter do
if PlayerData.job.name == filter[i] then
return PlayerData.job.name, PlayerData.job.grade
end
end
end
end
end
85 changes: 85 additions & 0 deletions [extras]/wasabi_fishing/bridge/esx/server.lua
@@ -0,0 +1,85 @@
if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports['es_extended']:getSharedObject()
Framework = 'esx'

function GetPlayer(source)
return ESX.GetPlayerFromId(source)
end

function KickPlayer(source, reason)
local player = GetPlayer(source)
return player.kick(reason)
end

function HasGroup(source, filter)
local player = GetPlayer(source)
local type = type(filter)

if type == 'string' then
if player.job.name == filter then
return player.job.name, player.job.grade
end
else
local tabletype = table.type(filter)

if tabletype == 'hash' then
local grade = filter[player.job.name]

if grade and grade <= player.job.grade then
return player.job.name, player.job.grade
end
elseif tabletype == 'array' then
for i = 1, #filter do
if player.job.name == filter[i] then
return player.job.name, player.job.grade
end
end
end
end
end

function GetIdentifier(source)
local xPlayer = ESX.GetPlayerFromId(source)
return xPlayer.identifier
end

function GetName(source)
local xPlayer = ESX.GetPlayerFromId(source)
return xPlayer.getName()
end

function RegisterUsableItem(item, cb)
ESX.RegisterUsableItem(item, cb)
end

function HasItem(source, item)
local player = GetPlayer(source)
local item = player.getInventoryItem(item)
if item ~= nil then
return item.count
else
return 0
end
end

function AddItem(source, item, count, slot, metadata)
local player = GetPlayer(source)
return player.addInventoryItem(item, count, metadata, slot)
end

function RemoveItem(source, item, count, slot, metadata)
local player = GetPlayer(source)
player.removeInventoryItem(item, count, metadata, slot)
end

function AddMoney(source, type, amount)
if type == 'cash' then type = 'money' end
local player = GetPlayer(source)
player.addAccountMoney(type, amount)
end

function RemoveMoney(source, type, amount)
if type == 'cash' then type = 'money' end
local player = GetPlayer(source)
player.removeAccountMoney(type, amount)
end

0 comments on commit b4dbaeb

Please sign in to comment.