Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cl_init .lua :
- bu Stormix red
- include('shared.lua')
- surface.CreateFont("NPCMedecin", {
- font = "Arial",
- size = 45,
- weight = 600,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = true,
- shadow = false,
- additive = false,
- outline = false,
- });
- surface.CreateFont("TextButtonMedic", {
- font = "Trebuchet18",
- size = 25,
- weight = 600,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- });
- function ENT:Draw()
- self:DrawModel();
- local pos = self:GetPos()+ Vector(0, 0, 72)
- local ang = self:GetAngles()
- ang:RotateAroundAxis(ang:Up(), 90);
- ang:RotateAroundAxis(ang:Forward(), 90);
- if LocalPlayer():GetPos():Distance(self:GetPos()) < 400 then
- cam.Start3D2D(pos + ang:Up(), Angle(0, LocalPlayer():EyeAngles().y-90, 90), 0.25)
- draw.SimpleTextOutlined("Médecin", "NPCMedecin", 0, -48, Color(52, 152, 219), TEXT_ALIGN_CENTER, TEXT_ALIGN_LEFT, 1, Color(25, 25, 25, 100));
- cam.End3D2D()
- end;
- end;
- function NPCMEDECIN(ply)
- local Frame = vgui.Create("DFrame")
- Frame:SetSize(620, 300)
- Frame:Center()
- Frame:SetTitle("Médecin")
- Frame:SetSizable(false)
- Frame:SetDeleteOnClose(false)
- Frame:MakePopup()
- Frame.Paint = function( self, w, h )
- draw.RoundedBox( 0, 0, 0, w, h, Color( 44, 62, 80 ) )
- end
- local FrameText1= vgui.Create( "DLabel", Frame)
- FrameText1:SetPos( 80, 30 )
- FrameText1:SetFont( "TextButtonMedic" )
- FrameText1:SetText( "Bonjour je suis Enzo le meilleur médeçin de la ville !" )
- FrameText1:SizeToContents()
- local FrameText2= vgui.Create( "DLabel", Frame)
- FrameText2:SetPos( 80, 50 )
- FrameText2:SetFont( "TextButtonMedic" )
- FrameText2:SetText( "Ah ! Vous avez très mal , je vais vous opérez au plus vite !" )
- FrameText2:SizeToContents()
- local ButtonFrameOui = vgui.Create( "DButton",Frame)
- ButtonFrameOui:SetPos( 100, 140 )
- ButtonFrameOui:SetText( "Faire l'opération (250 €)" )
- ButtonFrameOui:SetSize( 400, 40 )
- ButtonFrameOui:SetTextColor( Color( 255, 255, 255 ) )
- ButtonFrameOui.Paint = function( self, w, h )
- draw.RoundedBox( 0, 0, 0, w, h, Color( 192, 57, 43, 250 ) )
- if LocalPlayer().DarkRPVars.money < 250 then
- ButtonFrameOui:SetDisabled( true )
- elseif LocalPlayer():Health() >= 100 then
- end
- ButtonFrameOui.DoClick = function()
- net.Start("achetersoin")
- net.SendToServer()
- Frame:Close()
- end
- local ButtonFrameOui1 = vgui.Create( "DButton",Frame)
- ButtonFrameOui1:SetPos( 100, 140 )
- ButtonFrameOui1:SetText( "Soigner la moitié de la vie (150€)" )
- ButtonFrameOui1:SetSize( 400, 40 )
- ButtonFrameOui1:SetTextColor( Color( 255, 255, 255 ) )
- ButtonFrameOui1.Paint = function( self, w, h )
- draw.RoundedBox( 0, 0, 0, w, h, Color( 192, 57, 43, 250 ) )
- if LocalPlayer().DarkRPVars.money < 150 then
- ButtonFrameOui1:SetDisabled( true )
- elseif LocalPlayer():Health() >= 35 then
- end
- ButtonFrameOui1.DoClick = function()
- net.Start("achetersoin")
- net.SendToServer()
- Frame:Close()
- end
- end
- end
- usermessage.Hook("NPCMEDECIN", NPCMEDECIN)
- init.lua :
- AddCSLuaFile( "shared.lua" )
- AddCSLuaFile( "cl_init.lua" )
- include('shared.lua')
- function ENT:Initialize( )
- self:SetModel( "models/player/breen.mdl" ) ---model de l'addon
- self:SetMoveType(MOVETYPE_NONE)
- self:SetHullType( HULL_HUMAN )
- self:SetHullSizeNormal( )
- self:SetNPCState( 0 )
- self:SetSolid( SOLID_BBOX )
- self:CapabilitiesAdd(CAP_ANIMATEDFACE)
- self:SetUseType( SIMPLE_USE )
- self:DropToFloor()
- self:SetMaxYawSpeed( 90 )
- end
- function ENT:OnTakeDamage()
- return false
- end
- function ENT:AcceptInput( Name, Activator, Caller )
- if Name == "Use" and Caller:IsPlayer() then
- umsg.Start("NPCMEDECIN", Caller)
- umsg.End()
- end
- end
- util.AddNetworkString("achetersoin")
- net.Receive( "achetersoin" , function ( len , ply )
- if ply:getDarkRPVar("money") >= 100 then
- ply:addMoney( -500 )
- DarkRP.notify(ply,0,7,"Vous avez fait une opération pour 250€!")
- ply:SetHealth(100)
- else
- DarkRP.notify(ply,1,7,"Vous ne pouvez pas vous payer l'opération! (>€250)")
- end
- util.AddNetworkString("achetersoin")
- net.Receive( "achetersoin" , function ( len , ply )
- if ply:getDarkRPVar("money") >= 100 then
- ply:addMoney( -500 )
- DarkRP.notify(ply,0,7,"Vous avez été juste soigner (100€)")
- ply:SetHealth(100)
- else
- DarkRP.notify(ply,1,7,"Vous ne pouvez pas vous faire soigner (>€100)")
- end
- end)
- shared .lua :
- ENT.Type = "ai"
- ENT.Base = "base_ai"
- ENT.PrintName = "NPC Médecin"
- ENT.Author = "Stormix Red"
- ENT.Category = "Tuto Youtube"
- ENT.Spawnable = true
- ENT.AdminSpawnable = true
- ENT.AutomaticFrameAdvance = true
- function ENT:SetAutomaticFrameAdvance( bUsingAnim )
- self.AutomaticFrameAdvance = bUsingAnim
- end
- function ENT:PhysicsCollide(data, physobj)
- end;
- function ENT:PhysicsUpdate(physobj)
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement