dobrograd-13-06-2022/garrysmod/addons/feature-drugs/lua/entities/durgz_cocaine/init.lua
Jonny_Bro (Nikita) e4d5311906 first commit
2023-11-16 15:01:19 +05:00

53 lines
1.4 KiB
Lua

AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.MODEL = "models/cocn.mdl"
ENT.MASS = 2; --the model is too heavy so we have to override it with THIS
ENT.LASTINGEFFECT = 45; --how long the high lasts in seconds
function ENT:High(activator,caller)
sound.Play("drugs/insufflation.wav", activator:GetPos(), 75, 100, 1)
if !self:Realistic() then activator:SetHealth(activator:Health() / 2 ) end
if (activator:Health() > 1) then self:Say(activator, "MYNOSEISDRIBBLINGISANYONEELSESNOSEDRIBBLINGTHATSREALLYWEIRDIHOPEIDONTHAVEACOLD") end
self.MakeHigh = false;
if !self:Realistic() then
if activator:GetNetVar("durgz_cocaine_high_end", 0) < CurTime() then
self.MakeHigh = true;
end
end
end
function ENT:AfterHigh(activator, caller)
--kill them if they're weak
if (activator:Health() <=1) then
activator.DURGZ_MOD_DEATH = "durgz_cocaine";
activator.DURGZ_MOD_OVERRIDE = activator:Nick().." died of a heart attack (too much cocaine).";
activator:Kill()
return
end
if (self.MakeHigh) then
activator.durgz_cocaine_fast = true
pl:MoveModifier('drug', {
runmul = 6,
walkmul = 6,
})
end
end
--set speed back to normal once your high is over
hook.Add(
"Think",
"durgz_cocaine_resetspeed",
function()
for id,pl in pairs(player.GetAll())do
if pl.durgz_cocaine_fast and pl:GetNetVar("durgz_cocaine_high_end", 0) < CurTime() then
pl:MoveModifier('drug', nil)
pl.durgz_cocaine_fast = false
end
end
end
)