mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
68
gamemodes/darkrp/plugins/drugs/cl_hooks.lua
Normal file
68
gamemodes/darkrp/plugins/drugs/cl_hooks.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:RenderScreenspaceEffects()
|
||||
local character = LocalPlayer():GetCharacter()
|
||||
|
||||
DrawColorModify({
|
||||
["$pp_colour_addr"] = 0,
|
||||
["$pp_colour_addg"] = 0,
|
||||
["$pp_colour_addb"] = 0,
|
||||
["$pp_colour_brightness"] = 0,
|
||||
["$pp_colour_contrast"] = 1,
|
||||
["$pp_colour_colour"] = 1,
|
||||
["$pp_colour_mulr"] = 0,
|
||||
["$pp_colour_mulg"] = 0,
|
||||
["$pp_colour_mulb"] = 0
|
||||
})
|
||||
|
||||
if (character) then
|
||||
local drugEffects = character:GetDrugEffects()
|
||||
|
||||
if (!table.IsEmpty(drugEffects)) then
|
||||
for k, v in pairs(drugEffects) do
|
||||
local DrawEffect = PLUGIN.effects[k]
|
||||
|
||||
if (v > os.time() and isfunction(DrawEffect)) then
|
||||
if (ix.option.Get("drugEffects", true) == false) then
|
||||
local drugHighText = "You are currently high!"
|
||||
|
||||
surface.SetTextColor(239, 37, 14)
|
||||
surface.SetFont("HUDFontExtraLarge")
|
||||
surface.SetTextPos(ScrW() / 2 - (surface.GetTextSize(drugHighText) / 2), 0 + SScaleMin(100 / 3))
|
||||
surface.DrawText(drugHighText)
|
||||
|
||||
surface.SetDrawColor(239, 37, 14, 200)
|
||||
surface.DrawOutlinedRect(0, 0, ScrW(), ScrH(), 10)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
render.UpdateScreenEffectTexture()
|
||||
DrawEffect()
|
||||
render.DrawScreenQuad()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PopulateCharacterInfo(client, character, tooltip)
|
||||
local drugEffects = character:GetDrugEffects()
|
||||
|
||||
if (!table.IsEmpty(drugEffects) or client:GetNetVar("ixRave") or client:GetNetVar("ixSapphireDrug") and !client:GetNetVar("ixMaskEquipped")) then
|
||||
local row = tooltip:AddRow("drug")
|
||||
row:SetText("Bu kişi açıkça madde etkisi altında")
|
||||
row:SetBackgroundColor(Color(215, 0, 215, 255))
|
||||
row:SizeToContents()
|
||||
end
|
||||
end
|
||||
126
gamemodes/darkrp/plugins/drugs/sh_plugin.lua
Normal file
126
gamemodes/darkrp/plugins/drugs/sh_plugin.lua
Normal file
@@ -0,0 +1,126 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Drugs"
|
||||
PLUGIN.author = "AleXXX_007"
|
||||
PLUGIN.description = "Adds visual effects on certain items usage."
|
||||
|
||||
ix.option.Add("drugEffects", ix.type.bool, true, {
|
||||
category = "drugs"
|
||||
})
|
||||
|
||||
local redUberMaterial = Material("effects/invuln_overlay_red.vmt")
|
||||
local blueUberMaterial = Material("effects/invuln_overlay_blue.vmt")
|
||||
local redMaterial = Material("effects/bleed_overlay.vmt")
|
||||
local gasMaterial = Material("effects/gas_overlay.vmt")
|
||||
local jarateUberMaterial = Material("effects/jarate_overlay.vmt")
|
||||
local stealthMaterial = Material("effects/stealth_overlay.vmt")
|
||||
local distort1Material = Material("effects/distortion_normal001.vmt")
|
||||
|
||||
PLUGIN.effects = {
|
||||
["sobel"] = function()
|
||||
DrawSobel(0.5)
|
||||
end,
|
||||
["sharpen"] = function()
|
||||
DrawSharpen(1.2, 1.2)
|
||||
end,
|
||||
["blackAndWhite"] = function()
|
||||
DrawColorModify({
|
||||
["$pp_colour_colour"] = 0
|
||||
})
|
||||
end,
|
||||
["saturated"] = function()
|
||||
DrawColorModify({
|
||||
["$pp_colour_colour"] = 3
|
||||
})
|
||||
end,
|
||||
["redtint"] = function()
|
||||
DrawColorModify({
|
||||
["$pp_colour_addr"] = 1.3
|
||||
})
|
||||
end,
|
||||
["greentint"] = function()
|
||||
DrawColorModify({
|
||||
["$pp_colour_addg"] = 1.3
|
||||
})
|
||||
end,
|
||||
["bluetint"] = function()
|
||||
DrawColorModify({
|
||||
["$pp_colour_addb"] = 1.3
|
||||
})
|
||||
end,
|
||||
["bloom"] = function()
|
||||
DrawBloom(0.5, 2, 9, 9, 1, 1, 1, 1, 1)
|
||||
end,
|
||||
["redUber"] = function()
|
||||
render.SetMaterial(redUberMaterial)
|
||||
end,
|
||||
["blueUber"] = function()
|
||||
render.SetMaterial(blueUberMaterial)
|
||||
end,
|
||||
["red"] = function()
|
||||
render.SetMaterial(redMaterial)
|
||||
end,
|
||||
["gas"] = function()
|
||||
render.SetMaterial(gasMaterial)
|
||||
end,
|
||||
["jarate"] = function()
|
||||
render.SetMaterial(jarateUberMaterial)
|
||||
end,
|
||||
["stealth"] = function()
|
||||
render.SetMaterial(stealthMaterial)
|
||||
end,
|
||||
["distort1"] = function()
|
||||
render.SetMaterial(distort1Material)
|
||||
end
|
||||
}
|
||||
|
||||
--[[
|
||||
Simple texture may be registered by adding this:
|
||||
["redUber"] = function()
|
||||
render.SetMaterial("effect/path/here")
|
||||
end
|
||||
--]]
|
||||
|
||||
ix.util.Include("cl_hooks.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
|
||||
ix.char.RegisterVar("drugEffects", {
|
||||
field = "drugEffects",
|
||||
default = {},
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
do
|
||||
local COMMAND = {
|
||||
description = "@cmdRemoveDrugEffects",
|
||||
arguments = {
|
||||
ix.type.character
|
||||
},
|
||||
adminOnly = true
|
||||
}
|
||||
|
||||
function COMMAND:OnRun(client, character)
|
||||
if (character) then
|
||||
character:SetDrugEffects({})
|
||||
if (character:GetPlayer() and ix.plugin.list.rave or character:GetPlayer() and ix.plugin.listravebutsapphire) then
|
||||
ix.plugin.list.rave:Clear(character:GetPlayer())
|
||||
ix.plugin.list.ravebutsapphire:Clear(character:GetPlayer())
|
||||
end
|
||||
|
||||
client:Notify("İlaç etkileri şu kişiden kaldırıldı: "..character:GetName())
|
||||
end
|
||||
end
|
||||
|
||||
ix.command.Add("RemoveDrugEffects", COMMAND)
|
||||
end
|
||||
96
gamemodes/darkrp/plugins/drugs/sv_hooks.lua
Normal file
96
gamemodes/darkrp/plugins/drugs/sv_hooks.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
local function RemoveDrugEffect(character, effect)
|
||||
if (character) then
|
||||
local drugEffects = character:GetDrugEffects()
|
||||
|
||||
if (!table.IsEmpty(drugEffects)) then
|
||||
drugEffects[effect] = nil
|
||||
|
||||
character:SetDrugEffects(drugEffects)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerInteractItem(client, action, item, data)
|
||||
if (item.drug and !table.IsEmpty(item.drug)) then
|
||||
if (action == "give") then
|
||||
local target = item.player:GetEyeTraceNoCursor().Entity
|
||||
|
||||
if (IsValid(target) and target:IsPlayer()) then
|
||||
client = target
|
||||
elseif (IsValid(target.ixPlayer)) then
|
||||
client = target.ixPlayer
|
||||
end
|
||||
end
|
||||
|
||||
if ((action == "use" or action == "Consume" or action == "give")) then
|
||||
local character = client:GetCharacter()
|
||||
local drugEffects = character:GetDrugEffects()
|
||||
|
||||
for k, v in pairs(item.drug) do
|
||||
local time = v * 60
|
||||
drugEffects[k] = os.time() + time
|
||||
|
||||
local timerId = "ixDrugEffect_"..character:GetID().."_"..k
|
||||
|
||||
if (timer.Exists(timerId)) then
|
||||
timer.Adjust(timerId, timer.TimeLeft(timerId) + time, 1, function()
|
||||
RemoveDrugEffect(character, k)
|
||||
end)
|
||||
else
|
||||
timer.Create(timerId, time, 1, function()
|
||||
RemoveDrugEffect(character, k)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
character:SetDrugEffects(drugEffects)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerDeath(client)
|
||||
local character = client:GetCharacter()
|
||||
|
||||
if (character) then
|
||||
character:SetDrugEffects({})
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CharacterLoaded(character)
|
||||
local drugEffects = character:GetDrugEffects()
|
||||
|
||||
if (!table.IsEmpty(drugEffects)) then
|
||||
local toRemove = {}
|
||||
local osTime = os.time()
|
||||
|
||||
for k, v in pairs(drugEffects) do
|
||||
if (v > osTime) then
|
||||
local timerId = "ixDrugEffect_"..character:GetID().."_"..k
|
||||
|
||||
if (!timer.Exists(timerId)) then
|
||||
timer.Create(timerId, v - osTime, 1, function()
|
||||
RemoveDrugEffect(character, k)
|
||||
end)
|
||||
end
|
||||
else
|
||||
table.insert(toRemove, k)
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(toRemove) do
|
||||
RemoveDrugEffect(character, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user