Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cumulative update #776

Merged
merged 13 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ local function isPedDrivingAVehicle()
end

local function fscale(inputValue, originalMin, originalMax, newBegin, newEnd, curve)
local OriginalRange = 0.0
local NewRange = 0.0
local zeroRefCurVal = 0.0
local normalizedCurVal = 0.0
local rangedValue = 0.0
local OriginalRange, normalizedCurVal, zeroRefCurVal, NewRange, rangedValue
local invFlag = 0

if curve > 10.0 then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fx_version("adamant")
game("gta5")

description("esx_realisticvehicle")
description("bpt_RealisticVehicle")
lua54("yes")
version("1.0.1")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
function CreateAddonAccount(name, owner, money)
local self = {}
self.name = name
self.owner = owner
self.money = money
function self.addMoney(amount)
self.money = self.money + amount
self.save()
TriggerEvent("bpt_addonaccount:addMoney", self.name, amount)
end
function self.removeMoney(amount)
self.money = self.money - amount
self.save()
TriggerEvent("bpt_addonaccount:removeMoney", self.name, amount)
end
function self.setMoney(amount)
self.money = amount
self.save()
TriggerEvent("bpt_addonaccount:setMoney", self.name, amount)
end
function self.save()
if self.owner == nil then
MySQL.update("UPDATE addon_account_data SET money = ? WHERE account_name = ?", { self.money, self.name })
else
MySQL.update("UPDATE addon_account_data SET money = ? WHERE account_name = ? AND owner = ?", { self.money, self.name, self.owner })
end
TriggerClientEvent("bpt_addonaccount:setMoney", -1, self.name, self.money)
end
return self
end
function CreateAddonAccount(name, owner, money)
local self = {}

self.name = name
self.owner = owner
self.money = money

function self.addMoney(amount)
self.money = self.money + amount
self.save()
TriggerEvent("bpt_addonaccount:addMoney", self.name, amount)
end

function self.removeMoney(amount)
self.money = self.money - amount
self.save()
TriggerEvent("bpt_addonaccount:removeMoney", self.name, amount)
end

function self.setMoney(amount)
self.money = amount
self.save()
TriggerEvent("bpt_addonaccount:setMoney", self.name, amount)
end

function self.save()
if self.owner == nil then
MySQL.update("UPDATE addon_account_data SET money = ? WHERE account_name = ?", { self.money, self.name })
else
MySQL.update("UPDATE addon_account_data SET money = ? WHERE account_name = ? AND owner = ?", { self.money, self.name, self.owner })
end
TriggerClientEvent("bpt_addonaccount:setMoney", -1, self.name, self.money)
end

return self
end
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ function AddSharedAccount(society, amount)
if SharedAccounts[society.name] ~= nil then return SharedAccounts[society.name] end

-- addon account:
local account = MySQL.insert.await('INSERT INTO `addon_account` (name, label, shared) VALUES (?, ?, ?)', {
local account = MySQL.insert.await("INSERT INTO `addon_account` (name, label, shared) VALUES (?, ?, ?)", {
society.name, society.label, 1
})
if not account then return end

-- if addon account inserted, insert addon account data:
local account_data = MySQL.insert.await('INSERT INTO `addon_account_data` (account_name, money) VALUES (?, ?)', {
local account_data = MySQL.insert.await("INSERT INTO `addon_account_data` (account_name, money) VALUES (?, ?)", {
society.name, (amount or 0)
})
if not account_data then return end
Expand All @@ -91,7 +91,7 @@ AddEventHandler("esx:playerLoaded", function(_, xPlayer)
local account = GetAccount(name, xPlayer.identifier)

if account == nil then
MySQL.insert('INSERT INTO addon_account_data (account_name, money, owner) VALUES (?, ?, ?)',
MySQL.insert("INSERT INTO addon_account_data (account_name, money, owner) VALUES (?, ?, ?)",
{ name, 0, xPlayer.identifier })

account = CreateAddonAccount(name, xPlayer.identifier, 0)
Expand All @@ -106,13 +106,13 @@ end)

RegisterNetEvent("bpt_addonaccount:refreshAccounts")
AddEventHandler("bpt_addonaccount:refreshAccounts", function()
local addonAccounts = MySQL.query.await('SELECT * FROM addon_account')
local addonAccounts = MySQL.query.await("SELECT * FROM addon_account")

for i = 1, #addonAccounts, 1 do
local name = addonAccounts[i].name
local shared = addonAccounts[i].shared

local addonAccountData = MySQL.query.await('SELECT * FROM addon_account_data WHERE account_name = ?', { name })
local addonAccountData = MySQL.query.await("SELECT * FROM addon_account_data WHERE account_name = ?", { name })

if shared == 0 then
table.insert(AccountsIndex, name)
Expand All @@ -126,7 +126,7 @@ AddEventHandler("bpt_addonaccount:refreshAccounts", function()
local money = nil

if #addonAccountData == 0 then
MySQL.insert('INSERT INTO addon_account_data (account_name, money, owner) VALUES (?, ?, ?)',
MySQL.insert("INSERT INTO addon_account_data (account_name, money, owner) VALUES (?, ?, ?)",
{ name, 0, nil })
money = 0
else
Expand All @@ -141,4 +141,4 @@ end)

exports("getAccount", GetAccount)

exports("getSharedAccount", GetSharedAccount)
exports("getSharedAccount", GetSharedAccount)
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ INSERT INTO `bpt_items` (`name`, `label`) VALUES
('steel', 'steel'),
('plastic_bag', 'Plastic bag'),
('recycled_plastic', 'Recycled plastic'),
('WEAPON_NIGHTSTICK', 'NIGHTSTICK')
('WEAPON_NIGHTSTICK', 'NIGHTSTICK'),
('WEAPON_PISTOL', 'Pistol')
;
18 changes: 18 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_crafting/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,23 @@ Config = {
},
},

["WEAPON_PISTOL"] = {
Level = 10,
Category = "ammu",
isGun = false,
Jobs = { "ammu" },
JobGrades = {},
Amount = 1,
SuccessRate = 100,
requireBlueprint = false,
Time = 180,
Ingredients = {
["copper"] = 1,
["iron"] = 3,
["wood"] = 1,
["steel"] = 5,
},
},
["ammo-sniper"] = {
Level = 10,
Category = "ammu",
Expand Down Expand Up @@ -441,6 +458,7 @@ Config = {
"WEAPON_KNIFE",
"WEAPON_KNUCKLE",
"WEAPON_NIGHTSTICK",
"WEAPON_PISTOL",
},
radius = 1.0,
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ INSERT INTO `bpt_items` (`name`, `label`) VALUES
('WEAPON_KNUCKLE', 'tira pugni'),
('steel', 'acciaio'),
('plastic_bag', 'Sacchetto di plastica'),
('recycled_plastic', 'Plastica riciclata')
('WEAPON_NIGHTSTICK', 'Manganello')
('recycled_plastic', 'Plastica riciclata'),
('WEAPON_NIGHTSTICK', 'Manganello'),
('WEAPON_PISTOL', 'Pistola 9mm')
;
4 changes: 2 additions & 2 deletions server-data/resources/[bpt_addons]/bpt_deliveries/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
Copyright (C) 2024 bitpredator

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

<program> Copyright (C) <year> <name of author>
bpt_deliveries Copyright (C) 2024 bitpredator
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
Loading
Loading