Skip to content

Commit 5152333

Browse files
committed
feat: upload files
0 parents  commit 5152333

11 files changed

Lines changed: 3678 additions & 0 deletions

File tree

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# sd-selfstorage
2+
3+
sd-selfstorage is a comprehensive self-storage rental system for FiveM that allows players to rent or purchase storage units with advanced features including auto-renewal payments, access management, upgrades, and more.
4+
## Features
5+
- 🏢 **Rent or Purchase** - Players can either rent units weekly or buy them permanently
6+
- 💳 **Auto-Renewal System** - Automatic payments from bank accounts (configurable)
7+
- 👥 **Access Management** - Share storage access with other players
8+
- ⬆️ **Storage Upgrades** - Purchase additional slots and weight capacity
9+
-**Grace Period System** - 48-hour grace period for overdue payments
10+
- 🏦 **Banking Integration** - Works with banking systems that support static identifiers
11+
- 🌍 **Multi-Language Support** - Easy localization system
12+
- 📦 **ox_inventory Integration** - Full stash system with weight and slot limits
13+
14+
## Preview
15+
<img width="1920" height="1080" alt="image" src="https://github.com/user-attachments/assets/fd9b534a-89c9-4931-846d-b4d079fa8e7c" />
16+
17+
![FiveM_GTAProcess_GMUO1cRVPE](https://github.com/user-attachments/assets/f38e24d3-713d-477b-b1c1-66834e828e3d)
18+
![FiveM_GTAProcess_aNNN2aegP8](https://github.com/user-attachments/assets/969b86bc-90b1-4c12-bc24-e291499ef179)
19+
<img width="1920" height="1080" alt="FiveM_GTAProcess_Wk93zMVrwo" src="https://github.com/user-attachments/assets/2727e1d3-c744-4c35-abb0-5da62e4f332f" />
20+
21+
22+
## 🔔 Contact
23+
24+
Author: Samuel#0008
25+
Discord: [Join the Discord](https://discord.gg/FzPehMQaBQ)
26+
Store: [Click Here](https://fivem.samueldev.shop)
27+
28+
## 💾 Installation
29+
30+
1. Download the latest release from the repository
31+
2. Extract the downloaded file and rename the folder to `sd-selfstorage`
32+
3. Place the `sd-selfstorage` folder into your server's `resources` directory
33+
4. Add `ensure sd-selfstorage` to your `server.cfg`
34+
5. Configure the banking functions in `server/main.lua` (lines 14-37), if you want auto-renewal to work.
35+
6. Adjust the config file to your needs
36+
37+
## 📖 Dependencies
38+
- [ox_inventory](https://github.com/overextended/ox_inventory)
39+
- [ox_lib](https://github.com/overextended/ox_lib)
40+
- [qbx_core](https://github.com/Qbox-project/qbx_core) or [qb-core](https://github.com/qbcore-framework/qb-core)
41+
- oxmysql
42+
43+
## 📖 Configuration
44+
45+
### Banking System Setup
46+
The script supports two modes depending on your banking system:
47+
48+
#### For Banking Systems with Static Identifiers (IBAN, Account Numbers)
49+
```lua
50+
Banking = {
51+
hasStaticIdentifiers = true,
52+
noIdentifierMessage = 'Your banking system does not support automatic payments'
53+
}
54+
```
55+
56+
#### For Banking Systems without Static Identifiers
57+
```lua
58+
Banking = {
59+
hasStaticIdentifiers = false,
60+
noIdentifierMessage = 'Your banking system does not support automatic payments'
61+
}
62+
```
63+
64+
When `hasStaticIdentifiers = false`:
65+
- Auto-renewal features are disabled
66+
- Bank account linking is hidden
67+
- Only manual payments are available
68+
- Grace period and deletion systems still work
69+
70+
### Banking Functions
71+
Edit the banking functions in `server/main.lua` (lines 14-37):
72+
73+
```lua
74+
-- Example Integration with RxBanking
75+
Banking.GetPlayerAccount = function(identifier)
76+
local accountData = exports['RxBanking']:GetPlayerPersonalAccount(identifier)
77+
if type(accountData) == "table" then
78+
return accountData.iban
79+
elseif type(accountData) == "string" then
80+
return accountData
81+
end
82+
return nil
83+
end
84+
85+
Banking.RemoveAccountMoney = function(accountId, amount, unitId)
86+
return exports['RxBanking']:RemoveAccountMoney(
87+
accountId,
88+
amount,
89+
'payment',
90+
locale('storage_unit_autorenewal', { id = unitId }),
91+
nil
92+
)
93+
end
94+
```
95+
96+
## 📜 License
97+
This resource is protected by copyright. Redistribution or modification without permission is prohibited.
98+
99+
## 🤝 Support
100+
For support, join our [Discord](https://discord.gg/FzPehMQaBQ) or create an issue on GitHub.
101+
102+
103+
104+

bridge/client.lua

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
local EnableNotifOX = false -- Enable use of ox_lib for notifications if available
2+
local EnableNotifLation = false -- Enable use of lation_ui for notifications if available
3+
4+
--- Capitalizes the first letter of a string and lowercases the rest.
5+
---@param str string The string to capitalize.
6+
---@return string The capitalized string.
7+
CapitalizeFirst = function(str)
8+
return str:sub(1, 1):upper() .. str:sub(2):lower()
9+
end
10+
11+
--- Selects and returns the most appropriate notification function based on the current game setup.
12+
-- This function checks the available libraries and configurations to determine which notification method to use.
13+
-- It then returns a function tailored to use that method for showing notifications.
14+
---@return function A function configured to show notifications using the determined method.
15+
local CreateNotificationFunction = function()
16+
if lib ~= nil and EnableNotifOX then
17+
return function(message, type)
18+
local title = CapitalizeFirst(type or 'inform')
19+
lib.notify({
20+
id = math.random(1, 999999),
21+
title = title,
22+
description = message,
23+
type = type or 'inform'
24+
})
25+
end
26+
elseif EnableNotifLation then
27+
return function(message, type)
28+
local title = CapitalizeFirst(type or 'inform')
29+
exports.lation_ui:notify({
30+
title = title,
31+
message = message,
32+
type = type or 'info',
33+
})
34+
end
35+
else
36+
if Framework == 'esx' then
37+
return function(message, _)
38+
ESX.ShowNotification(message)
39+
end
40+
elseif Framework == 'qb' then
41+
return function(message, type)
42+
QBCore.Functions.Notify(message, type or 'info')
43+
end
44+
end
45+
46+
return function(message, type)
47+
error(string.format("Notification system not supported. Message was: %s, Type was: %s", message, type))
48+
end
49+
end
50+
end
51+
52+
--- The chosen method for showing notifications, determined at the time of script initialization.
53+
local Notify = CreateNotificationFunction()
54+
55+
--- Display a notification to the user.
56+
-- This function triggers a notification with a specific message and type.
57+
---@param message string The text of the notification to be displayed.
58+
---@param type string The type of notification, which may dictate the visual style or urgency.
59+
ShowNotification = function(message, type)
60+
Notify(message, type)
61+
end

bridge/init.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-- Framework detection function
2+
local DetectFramework = function()
3+
if GetResourceState('qb-core') == 'started' then
4+
return 'qb', exports['qb-core']:GetCoreObject()
5+
end
6+
7+
if GetResourceState('es_extended') == 'started' then
8+
return 'esx', exports['es_extended']:getSharedObject()
9+
end
10+
11+
return nil, nil
12+
end
13+
14+
-- Detect and initialize framework
15+
local framework, core = DetectFramework()
16+
17+
if not framework then
18+
error([[
19+
^1CRITICAL ERROR: No supported framework detected!^0
20+
^3This resource requires one of the following frameworks:^0
21+
- QBCore (qb-core)
22+
- ESX (es_extended)
23+
24+
Please ensure your framework is started before this resource.
25+
]])
26+
return
27+
end
28+
29+
Framework = framework
30+
Core = core
31+
32+
-- Set framework-specific globals for compatibility
33+
if Framework == 'qb' then
34+
QBCore = Core
35+
elseif Framework == 'esx' then
36+
ESX = Core
37+
end

0 commit comments

Comments
 (0)