Garry's Mod

Garry's Mod

DarkRP Advanced Paramedic System - Content
Heyron ∆ 4 Jun, 2024 @ 8:24am
HealthNPC Helix configuration
darkrpadvancedparamedicsystem\lua\entitites\npc_health\init.lua

util.AddNetworkString( "MEDIC_HealthMenu" ) function ENT:AcceptInput( ply, caller ) if caller:IsPlayer() && !caller.CantUse then caller.CantUse = true timer.Simple(3, function() caller.CantUse = false end) local RequiredTeamsCount = 0 local RequiredPlayersCounted = 0 for k, v in pairs( player.GetAll() ) do RequiredPlayersCounted = RequiredPlayersCounted + 1 if table.HasValue( CH_AdvMedic.Config.AllowedTeams, team.GetName( v:Team() ) ) then RequiredTeamsCount = RequiredTeamsCount + 1 end if RequiredPlayersCounted == #player.GetAll() then if RequiredTeamsCount < CH_AdvMedic.Config.RequiredMedics then DarkRP.notify( caller, 1, 5, "There has to be ".. CH_AdvMedic.Config.RequiredMedics .." paramedics before you can use this service." ) return end end end net.Start("MEDIC_HealthMenu", caller) net.Send( caller ) end end util.AddNetworkString("MEDIC_PurchaseHealth") net.Receive("MEDIC_PurchaseHealth", function(length, ply) if ply:Health() >= ply:GetMaxHealth() then DarkRP.notify( ply, 1, 5, "Your health is already at "..ply:GetMaxHealth().."." ) return end if ply:GetCharacter():GetMoney() >= CH_AdvMedic.Config.HealthPrice then ply:SetHealth( ply:GetMaxHealth() ) DarkRP.notify( ply, 1, 5, "Your health has been refilled. You have been charged ".. ix.currency.Get( CH_AdvMedic.Config.HealthPrice ) ) ply:GetCharacter():TakeMoney( -1 * CH_AdvMedic.Config.HealthPrice) else DarkRP.notify( ply, 1, 5, "You cannot afford to refill your health!" ) end end)

darkrpadvancedparamedicsystem\lua\entitites\npc_health\cl_init.lua

include("shared.lua") surface.CreateFont("FiretruckFont", { font = "Tahoma", size = 15, weight = 600 }) surface.CreateFont("HealthMenuFont", { font = "Trebuchet MS", size = 35, weight = 800 }) surface.CreateFont("HealthMenuFontSmall", { font = "Trebuchet MS", size = 20, weight = 800 }) net.Receive( "MEDIC_HealthMenu", function() local GUI_Health_Frame = vgui.Create("DFrame") GUI_Health_Frame:SetTitle("") GUI_Health_Frame:SetSize( 600, 220 ) GUI_Health_Frame:Center() GUI_Health_Frame.Paint = function( self ) draw.RoundedBox( 0, 5, 5, self:GetWide() - 10, self:GetTall() - 10, Color( 42, 42, 42, 200 ) ) draw.RoundedBox( 0, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 100 ) ) -- Draw the top title. --draw.SimpleText("Health Station", "FiretruckFont", 70, 17.5, Color( 255, 255, 255, 200 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end GUI_Health_Frame:MakePopup() GUI_Health_Frame:ShowCloseButton(false) local AS_Exit = vgui.Create("DButton", GUI_Health_Frame) AS_Exit:SetSize( ScreenScale( 5.3 ), ScreenScale( 5.3 ) ) AS_Exit:SetPos( GUI_Health_Frame:GetWide() - 25, 10 ) AS_Exit:SetText("") AS_Exit.Paint = function() surface.SetMaterial(Material("icon16/cross.png")) surface.SetDrawColor(200,200,0,200) surface.DrawTexturedRect(0,0,AS_Exit:GetWide(),AS_Exit:GetTall()) end AS_Exit.DoClick = function() GUI_Health_Frame:Remove() end local TruckDisplay = vgui.Create("DModelPanel", GUI_Health_Frame) TruckDisplay:SetModel( CH_AdvMedic.Config.HealthNPCModel ) TruckDisplay:SetPos( 10, 15 ) TruckDisplay:SetSize( 200, 200 ) function TruckDisplay:LayoutEntity( Entity ) return end local headpos = TruckDisplay.Entity:GetBonePosition( TruckDisplay.Entity:LookupBone( "ValveBiped.Bip01_Head1" ) ) TruckDisplay:SetLookAt( headpos ) TruckDisplay:SetCamPos( headpos - Vector( -13, 0, 0 ) ) TruckDisplay.Entity:SetEyeTarget( headpos - Vector( -13, 0, 0 ) ) local GUI_PurchaseHealth = vgui.Create("DButton", GUI_Health_Frame) GUI_PurchaseHealth:SetSize(360,80) GUI_PurchaseHealth:SetPos(220,30) GUI_PurchaseHealth:SetText("") GUI_PurchaseHealth.Paint = function(self) surface.SetDrawColor(60, 60, 60, 80) surface.DrawRect(0, 0, self:GetWide(), self:GetTall()) surface.SetDrawColor(0,0,0,220) surface.DrawOutlinedRect(0, 0, self:GetWide(), self:GetTall()) local struc = {} struc.pos = {} struc.pos[1] = 180 struc.pos[2] = 32.5 struc.color = Color(255,255,255,255) struc.text = "Purchase Health" struc.font = "HealthMenuFont" struc.xalign = TEXT_ALIGN_CENTER struc.yalign = TEXT_ALIGN_CENTER draw.Text( struc ) local struc2 = {} struc2.pos = {} struc2.pos[1] = 180 struc2.pos[2] = 57.5 struc2.color = Color(255,255,255,255) struc2.text = "Price: ".. ix.currency.Get( CH_AdvMedic.Config.HealthPrice ) struc2.font = "HealthMenuFontSmall" struc2.xalign = TEXT_ALIGN_CENTER struc2.yalign = TEXT_ALIGN_CENTER draw.Text( struc2 ) end GUI_PurchaseHealth.DoClick = function() net.Start("MEDIC_PurchaseHealth") net.SendToServer() GUI_Health_Frame:Remove() end end)

i remove armor codes but u can easly add.