Skip to content

Commit

Permalink
chore: set the fish sale in bpt_sellpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Sep 30, 2024
1 parent b484e85 commit 0396030
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 95 deletions.
4 changes: 4 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_pointsell/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Config.Locale = GetConvar("esx:locale", "it")
Config.DealerItems = {
emerald = 50,
diamond = 150,
tuna = 300,
salmon = 230,
trout = 190,
anchovy = 100,
}

Config.GiveBlack = true -- give black money? if disabled it'll give regular cash.
Expand Down
2 changes: 0 additions & 2 deletions server-data/resources/[wasabi]/wasabi_fishing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ This resource was created as a free interactive fishing script for ESX/QBCore se
- 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
Expand Down
48 changes: 0 additions & 48 deletions server-data/resources/[wasabi]/wasabi_fishing/client/client.lua
Original file line number Diff line number Diff line change
@@ -1,53 +1,5 @@
local fishing = false

if Config.sellShop.enabled then
CreateThread(function()
local ped, textUI
CreateBlip(Config.sellShop.coords, 356, 1, Strings.sell_shop_blip, 0.80)
local point = lib.points.new({
coords = Config.sellShop.coords,
distance = 30,
})

function point:nearby()
if self.currentDistance < self.distance then
if not ped then
lib.requestAnimDict("mini@strip_club@idles@bouncer@base", 100)
lib.requestModel(Config.sellShop.ped, 100)
ped = CreatePed(28, Config.sellShop.ped, Config.sellShop.coords.x, Config.sellShop.coords.y, Config.sellShop.coords.z, Config.sellShop.heading, false, false)
FreezeEntityPosition(ped, true)
SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true)
TaskPlayAnim(ped, "mini@strip_club@idles@bouncer@base", "base", 8.0, 0.0, -1, 1, 0, 0, 0, 0)
end
if self.currentDistance <= 1.8 then
if not textUI then
lib.showTextUI(Strings.sell_fish)
textUI = true
end
if IsControlJustReleased(0, 38) then
FishingSellItems()
end
elseif self.currentDistance >= 1.9 and textUI then
lib.hideTextUI()
textUI = nil
end
end
end

function point:onExit()
if ped then
local model = GetEntityModel(ped)
SetModelAsNoLongerNeeded(model)
DeletePed(ped)
SetPedAsNoLongerNeeded(ped)
RemoveAnimDict("mini@strip_club@idles@bouncer@base")
ped = nil
end
end
end)
end

RegisterNetEvent("wasabi_fishing:startFishing", function()
if IsPedInAnyVehicle(cache.ped) or IsPedSwimming(cache.ped) then
TriggerEvent("wasabi_fishing:notify", Strings.cannot_perform, Strings.cannot_perform_desc, "error")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,3 @@ end
TryFish = function(data)
TriggerServerEvent("wasabi_fishing:tryFish", data)
end

FishingSellItems = function()
TriggerServerEvent("wasabi_fishing:sellFish")
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ Config = {}
Config.checkForUpdates = true -- Check for updates?
Config.oldESX = false -- Nothing to do with qb / Essentially when set to true it disables the check of if player can carry item

Config.sellShop = {
enabled = true,
coords = vec3(-1612.19, -989.18, 13.01 - 0.9), -- X, Y, Z Coords of where fish buyer will spawn
heading = 45.3, -- Heading of fish buyer ped
ped = "cs_old_man2", -- Ped name here
}

Config.bait = {
itemName = "fishbait", -- Item name of bait
loseChance = 65, -- Chance of loosing bait(Setting to 100 will use bait every cast)
Expand All @@ -27,11 +20,11 @@ Config.timeForBite = { -- Set min and max random range of time it takes for fish
}

Config.fish = {
{ item = "tuna", label = "Tuna", price = { 300, 550 }, difficulty = { "medium", "easy", "easy" } }, -- name is the item name of the fish(must be in DB of items) / Price is the range of price it will sell to fish buyer / difficulty is how many & how hard skillcheck is
{ item = "salmon", label = "Salmon", price = { 235, 300 }, difficulty = { "medium", "easy" } },
{ item = "trout", label = "Trout", price = { 190, 235 }, difficulty = { "easy", "easy" } },
{ item = "anchovy", label = "Anchovy", price = { 100, 190 }, difficulty = { "easy" } },
{ item = "plastic_bag", label = "Plastic Bag", price = { 100, 190 }, difficulty = { "easy" } },
{ item = "tuna", label = "Tuna", difficulty = { "easy" } },
{ item = "salmon", label = "Salmon", difficulty = { "easy" } },
{ item = "trout", label = "Trout", difficulty = { "easy" } },
{ item = "anchovy", label = "Anchovy", difficulty = { "easy" } },
{ item = "plastic_bag", label = "Plastic Bag", difficulty = { "easy" } },
}

RegisterNetEvent("wasabi_fishing:notify")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Strings = {
bait_lost_desc = "Fishing bait was lost.",
fish_success = "Caught Fish",
fish_success_desc = "You caught a %s!",
sell_shop_blip = "Fish Market",
sell_fish = "[E] - Sell Fish",
kicked = "Nice try, please do not attempt to exploit!",
sold_for = "Sold Fish",
sold_for_desc = "You sold %sx %s for $%s",
Expand Down
27 changes: 0 additions & 27 deletions server-data/resources/[wasabi]/wasabi_fishing/server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,6 @@ RegisterNetEvent("wasabi_fishing:tryFish", function(data)
end
end)

RegisterNetEvent("wasabi_fishing:sellFish", function()
local playerPed = GetPlayerPed(source)
local playerCoord = GetEntityCoords(playerPed)
local distance = #(playerCoord - Config.sellShop.coords)
if distance == nil then
KickPlayer(source, Strings.kicked)
return
end
if distance > 3 then
KickPlayer(source, Strings.kicked)
return
end
for i = 1, #Config.fish do
if HasItem(source, Config.fish[i].item) > 0 then
local rewardAmount = 0
for j = 1, HasItem(source, Config.fish[i].item) do
rewardAmount = rewardAmount + math.random(Config.fish[i].price[1], Config.fish[i].price[2])
end
if rewardAmount > 0 then
AddMoney(source, "money", rewardAmount)
TriggerClientEvent("wasabi_fishing:notify", source, Strings.sold_for, (Strings.sold_for_desc):format(HasItem(source, Config.fish[i].item), Config.fish[i].label, addCommas(rewardAmount)), "success")
RemoveItem(source, Config.fish[i].item, HasItem(source, Config.fish[i].item))
end
end
end
end)

RegisterUsableItem(Config.fishingRod.itemName, function(source)
TriggerClientEvent("wasabi_fishing:startFishing", source)
end)

0 comments on commit 0396030

Please sign in to comment.