Gmod Pocket System without DarkRP - Script
Inspired by the Pocket system of DarkRP, here is a light and minimalist version of my inventory system. It's a Swep that you must own to use. Quickly store whitelisted items with the left click and right click to drop the item where you are looking. Use the Reload key to display your Pocket's inventory.
❮
❯
Description of Gmod Pocket System without DarkRP
Contents:- π Description of the Gmod Pocket System without DarkRP addon
- π SWEP Pocket
- πΉοΈ Give
- β What type of need can Gmod Pocket System meet?
- 𧩠Useful combination with other scripts?
- π API associated with this Gmod Pocket addon
- π οΈ Configuration options from the configuration file
- βοΈ Why is this pocket system a better alternative to the DarkRP pocket?
π Description of the Gmod Pocket System without DarkRP addon
Gmod Pocket System without DarkRP has been designed for those who want a simple minimalist storage system. It's a storage system that makes up for the shortcomings of the DarkRP pocket system but can also work without DarkRP, as far as optimization is concerned, it doesn't download the entire contents of the pocket every time you pick up an item, and it's also smaller than my inventory system. Coded independently from any other system you can also make it work without the DarkRP gamemode. So you don't need DarkRP to make it work.
The system has a minimalist database that allows players when they come back to find their pocket on their character with its content.
This script does the job of the pocket you already know. I've made sure that old habits aren't broken.
Unlike my other inventory system, this one is a swep pocket that you can drop with its contents.
π SWEP Pocket
Gmod Pocket System is a sweep that you can drop with its contents.
A more attractive and intuitive menu will open with the Reload key in a fluid way. With the possibility to bind a key (Default P for Pocket).
The left click will allow you to store inside the objects you are aiming at.
And the right click will allow you to drop the stored objects in the order where you look.
Class name of the weapon : norda_pocket
So if it is not equipped, you will not be able to store or open it.
From the config file you can choose to default it at spawn time. For those who want only certain jobs to spawn with a pocket on DarkRP and not everyone, you will need to add it to the job sweep list in the JobRelated.lua file in the same way as your old pocket system.
πΉοΈ Give
An option in the configuration file will allow you to give the pocket to the players when they connect.
You can also distribute it via the jobrelated.lua file or in other ways via the spawnmenu or other.
β What type of need can Gmod Pocket System meet?
-Are you looking to replace one by one the DarkRP modules that make up your server? The pocket is one of them.
-You want to correct the optimization problems of the DarkRP pocket ? This one does not correct it, it replaces it completely.
-You want to leave DarkRP but you are looking for a new pocket system that doesn't upset your players' habits with the old pocket ? And that works ?
𧩠Useful combination with other scripts?
The script works well alone. But did you know that it is possible to have a pocket for each character in Gmod Character Creator System.
The items created via Norda Pack Items are automatically added to the whitelist.
π API associated with this Gmod Pocket addon
- Client + server side:
Player:GetMaxPocket() = Returns the max storage capacity in the pocket. The max capacity is defined in the configuration file by the variable: cfg.Pocket_max.
player:GetPocketItems() = Return the table of the list of objects stored in the pocket.
- On the server side:
Player:StoreInPocket(class,qt,mdl,clip2) = Allows to store an entity with only the class name of that one.
Player:AddInPocket(ent,quantity) = Store an existing entity on the gmod server map.
Player:DropFromPocket(id) = Drop an item stored in the pocket.
Player:SavePocket() = Force save the pocket
π οΈ Configuration options from the configuration file
-----CONFIGURATION-----
cfg.OwnerSteamID="STEAM_0:0:000000000000" --If you are the owner and you dont use Admin System put your Steam ID here. Value exemple:---> "STEAM_0:1:125347606"
cfg.USeWorkshopContent=1 --If you dont have a fastdownload you can use workshop content(1 Enable "I want use workshop" / 0 Disable "I prefer use my fastdl")
cfg.notification_stock =1 -- Notify when an object is stored in the inventory
cfg.inv_give_pocket =1 -- Give the 'Pocket' to the players at the spawn
cfg.store_weapons =1 -- 1 = The pocket can store weapons. 0 = The pocket cannot store weapons.
-----Custom SOUND Effect-----
cfg.Sound_Store = "npc/zombie/foot_slide2.wav" -- Sound effect when items is stored
cfg.Sound_Drop = "npc/zombie/foot_slide2.wav" -- Sound effect when items is droped
cfg.Sound_Open = "norda_pocket/pocket_open.mp3" -- Sound effect when the pocket is open
cfg.Sound_Close = "norda_pocket/pocket_close.mp3" -- Sound effect when the pocket is close
cfg.Sound_Button = "npc/zombie/foot_slide2.wav" -- Sound effect when we clic on item in pocket
----------STYLE----------
cfg.Custom_Fonts="Trebuchet24" -- Custom Fonts
cfg.background_color = Color(0,0,0,150) -- Background Color of the pocket Panel
cfg.buttons_color = Color(0,162,232,255) -- Buttons Color of the pocket Panel
cfg.title_color = Color(255,255,255) -- Title Color of the pocket Panel
cfg.txt_color = Color(255,255,255,200)-- Texte Color of the pocket Panel
cfg.pocket_posx = 50 -- Horizontal position of the pocket panel according to the percentage of the resolution. 50% = Center
cfg.pocket_posy = 50 -- Verticale position of the pocket panel according to the percentage of the resolution. 50% = Center
cfg.pocket_size_wide = 47 -- Wide Size of the pocket panel according to the percentage of the resolution.
cfg.pocket_size_tall = 35 -- Tall Size of the pocket panel according to the percentage of the resolution.
cfg.style_rounded = 4 -- Rounding the corners
cfg.slot_size = 62 -- Size in pixels of the cells in the pocket.
cfg.mode_item_image = 0 -- Image display mode of the objects. Choose between the entity image given in the gmod spawnmenu and the 3D model of the object.
βοΈ Why is this pocket system a better alternative to the DarkRP pocket?
First of all my pocket is not dependent on the gamemode to work.
Secondly, on a practical level, I don't know if I'm missing an API in DarkRP (feel free to inform me), but the DarkRP pocket is not made to work on a server, you are forced to spawn an object to be able to store it in your pocket as an entity and all its table. That's all I want to avoid and have managed to avoid in my systems.
For the DarkRP pocket we have player:addPocketItem(entity) knowing that every time the pocket is opened the client is constantly downloading its own storage and it's a huge amount of information, you'll observe it with little freeze and accompanied by spikes in the net_graph if you have a lot of items in your darkrp pocket.
With my inventory or pocket nothing like that, we have: player:StoreInPocket("class name here", quantity), we store only the class name and the quantity.
My system transmits the information to the client its two variables directly without spawn anything.
And when the client opens my inventory, it doesn't download its content again. This means that whatever the quantity of objects it will not change anything in terms of bandwidth and CPU whether it is 10 or 1000.
Since it has already received the information in the form of a small text from the last object. And not as an entity table. The net_graph 3 command will allow you to see this and observe the difference which is major.
Path: garrysmod/addons/norda_pocket_system
- The AddWorkshop function is automatically added to the script server file and can be deactivated from the configuration file. : resource.AddWorkshop( 2885643265 )
- To add gmod workshop resources to your collection : Gmod Pocket System without DarkRP [Content Only] | Gmod Workshop
1 = Give the pocket at spawn. 0 = OFF
will allow you to set the size of the pocket interface, the values are the percentage of the resolution.
will allow you to set the position of the pocket menu, the values are the percentage of the resolution. 50 means 50% that means center of the screen.
cfg.background_color = Background color of the pocket panel
cfg.buttons_color = Pocket panel buttons color
cfg.title_color = Pocket panel title color
cfg.txt_color = Pocket panel text color
cfg.store_weapons =1 -- 1 = The pocket can store weapons. 0 = The pocket cannot store weapons.
cfg.Items_Blacklist={
norda_pocket=true, // Avoid to store the other pocket in the pocket
}
cfg.Items_Whitelist={
// HL2 EXAMPLE ITEMS
item_battery =true,
item_healthkit =true,
item_healthvial =true,
// HL2 EXAMPLE AMMOS
item_ammo_357 =true,
item_ammo_ar2 =true,
item_ammo_ar2_altfire =true,
item_box_buckshot =true,
item_ammo_smg1 =true,
item_ammo_pistol =true,
}
Will play sounds specific to a type of action linked to the pocket.
cfg.Sound_Store = Sound effect when objects are stored.
cfg.Sound_Drop = Sound effect when objects are dropped.
cfg.Sound_Open = Sound effect when the pocket is opened
cfg.Sound_Close = Sound effect when pocket is closed
cfg.Sound_Button = Sound effect when clicking on an object in the pocket.