mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
23
gamemodes/darkrp/plugins/descriptionitems/cl_hooks.lua
Normal file
23
gamemodes/darkrp/plugins/descriptionitems/cl_hooks.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
function PLUGIN:PopulateCharacterInfo(client, character, tooltip)
|
||||
local visibileItems = client:GetNetVar("visibleItems", {})
|
||||
|
||||
for itemName, _ in pairs(visibileItems) do
|
||||
itemName = L(itemName)
|
||||
|
||||
local row = tooltip:AddRow("visibileItem_" .. itemName)
|
||||
row:SetBackgroundColor(color_white)
|
||||
row:SetText("Il porte : " .. itemName .. ".")
|
||||
row:SizeToContents()
|
||||
end
|
||||
end
|
||||
17
gamemodes/darkrp/plugins/descriptionitems/sh_plugin.lua
Normal file
17
gamemodes/darkrp/plugins/descriptionitems/sh_plugin.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
PLUGIN.name = "Description Items"
|
||||
PLUGIN.author = "Aspect™"
|
||||
PLUGIN.description = "Adds a description to a player if they are carrying a large item."
|
||||
|
||||
ix.util.Include("cl_hooks.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
73
gamemodes/darkrp/plugins/descriptionitems/sv_hooks.lua
Normal file
73
gamemodes/darkrp/plugins/descriptionitems/sv_hooks.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
function PLUGIN:InventoryItemAdded(oldInv, inventory, item)
|
||||
-- New Inventory
|
||||
if (inventory) then
|
||||
local client = inventory.owner and ix.char.loaded[inventory.owner] and ix.char.loaded[inventory.owner]:GetPlayer()
|
||||
|
||||
if (client) then
|
||||
if (item.width >= 3 and item.height >= 4) then
|
||||
local currentItems = client:GetNetVar("visibleItems", {})
|
||||
|
||||
currentItems[item.name] = true
|
||||
|
||||
client:SetNetVar("visibleItems", currentItems)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Old Inventory
|
||||
if (oldInv) then
|
||||
local client = oldInv.owner and ix.char.loaded[oldInv.owner] and ix.char.loaded[oldInv.owner]:GetPlayer()
|
||||
|
||||
if (client and item.width >= 3 and item.height >= 4) then
|
||||
local currentItems = client:GetNetVar("visibleItems", {})
|
||||
|
||||
if (currentItems[item.name]) then
|
||||
currentItems[item.name] = nil
|
||||
end
|
||||
|
||||
client:SetNetVar("visibleItems", currentItems)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerInteractItem(client, action, item)
|
||||
if (action == "drop") then
|
||||
if (item.width >= 3 and item.height >= 4) then
|
||||
local currentItems = client:GetNetVar("visibleItems", {})
|
||||
|
||||
if (currentItems[item.name]) then
|
||||
currentItems[item.name] = nil
|
||||
end
|
||||
|
||||
client:SetNetVar("visibleItems", currentItems)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerSpawn(client)
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return end
|
||||
|
||||
timer.Simple(1, function()
|
||||
local currentItems = {}
|
||||
|
||||
for _, item in pairs(character:GetInventory():GetItems()) do
|
||||
if (item.width < 3 or item.height < 4) then continue end
|
||||
|
||||
currentItems[item.name] = true
|
||||
end
|
||||
|
||||
client:SetNetVar("visibleItems", currentItems)
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user