Advertisement
Guest User

Addon By stormix red

a guest
May 25th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.34 KB | None | 0 0
  1. cl_init .lua :
  2.  
  3. bu Stormix red
  4.  
  5. include('shared.lua')
  6.  
  7. surface.CreateFont("NPCMedecin", {
  8.     font = "Arial",
  9.     size = 45,
  10.     weight = 600,
  11.     blursize = 0,
  12.     scanlines = 0,
  13.     antialias = true,
  14.     underline = false,
  15.     italic = false,
  16.     strikeout = false,
  17.     symbol = false,
  18.     rotary = true,
  19.     shadow = false,
  20.     additive = false,
  21.     outline = false,
  22. });
  23.  
  24. surface.CreateFont("TextButtonMedic", {
  25.     font = "Trebuchet18",
  26.     size = 25,
  27.     weight = 600,
  28.     blursize = 0,
  29.     scanlines = 0,
  30.     antialias = true,
  31.     underline = false,
  32.     italic = false,
  33.     strikeout = false,
  34.     symbol = false,
  35.     rotary = false,
  36.     shadow = false,
  37.     additive = false,
  38.     outline = false,
  39. });
  40.  
  41.  
  42. function ENT:Draw()
  43.     self:DrawModel();
  44.  
  45.     local pos = self:GetPos()+ Vector(0, 0, 72)
  46.     local ang = self:GetAngles()
  47.  
  48.  
  49.     ang:RotateAroundAxis(ang:Up(), 90);
  50.     ang:RotateAroundAxis(ang:Forward(), 90);
  51.     if LocalPlayer():GetPos():Distance(self:GetPos()) < 400 then
  52.         cam.Start3D2D(pos + ang:Up(), Angle(0, LocalPlayer():EyeAngles().y-90, 90), 0.25)
  53.                 draw.SimpleTextOutlined("Médecin", "NPCMedecin", 0, -48, Color(52, 152, 219), TEXT_ALIGN_CENTER, TEXT_ALIGN_LEFT, 1, Color(25, 25, 25, 100));  
  54.         cam.End3D2D()
  55.     end;
  56. end;
  57.  
  58.  
  59. function NPCMEDECIN(ply)
  60.  
  61. local Frame = vgui.Create("DFrame")
  62. Frame:SetSize(620, 300)
  63. Frame:Center()
  64. Frame:SetTitle("Médecin")
  65. Frame:SetSizable(false)
  66. Frame:SetDeleteOnClose(false)
  67. Frame:MakePopup()
  68. Frame.Paint = function( self, w, h )
  69. draw.RoundedBox( 0, 0, 0, w, h, Color( 44, 62, 80 ) )
  70. end
  71.  
  72. local FrameText1= vgui.Create( "DLabel", Frame)
  73.     FrameText1:SetPos( 80, 30 )
  74.     FrameText1:SetFont( "TextButtonMedic" )
  75.     FrameText1:SetText( "Bonjour je suis Enzo le meilleur médeçin de la ville !" )
  76.     FrameText1:SizeToContents()
  77.  
  78.     local FrameText2= vgui.Create( "DLabel", Frame)
  79.     FrameText2:SetPos( 80, 50 )
  80.     FrameText2:SetFont( "TextButtonMedic" )
  81.     FrameText2:SetText( "Ah ! Vous avez très mal , je vais vous opérez au plus vite !" )
  82.     FrameText2:SizeToContents()
  83.  
  84. local ButtonFrameOui = vgui.Create( "DButton",Frame)
  85. ButtonFrameOui:SetPos( 100, 140 )
  86.     ButtonFrameOui:SetText( "Faire l'opération (250 €)" )
  87.     ButtonFrameOui:SetSize( 400, 40 )
  88.     ButtonFrameOui:SetTextColor( Color( 255, 255, 255 ) )
  89.     ButtonFrameOui.Paint = function( self, w, h )
  90.     draw.RoundedBox( 0, 0, 0, w, h, Color( 192, 57, 43, 250 ) )
  91.     if LocalPlayer().DarkRPVars.money < 250 then
  92.     ButtonFrameOui:SetDisabled( true )
  93.     elseif LocalPlayer():Health() >= 100 then
  94.     end
  95.     ButtonFrameOui.DoClick = function()
  96.     net.Start("achetersoin")
  97.     net.SendToServer()
  98.     Frame:Close()
  99.     end
  100.  
  101. local ButtonFrameOui1 = vgui.Create( "DButton",Frame)
  102. ButtonFrameOui1:SetPos( 100, 140 )
  103.     ButtonFrameOui1:SetText( "Soigner la moitié de la vie (150€)" )
  104.     ButtonFrameOui1:SetSize( 400, 40 )
  105.     ButtonFrameOui1:SetTextColor( Color( 255, 255, 255 ) )
  106.     ButtonFrameOui1.Paint = function( self, w, h )
  107.     draw.RoundedBox( 0, 0, 0, w, h, Color( 192, 57, 43, 250 ) )
  108.     if LocalPlayer().DarkRPVars.money < 150 then
  109.     ButtonFrameOui1:SetDisabled( true )
  110.     elseif LocalPlayer():Health() >= 35 then
  111.     end
  112.     ButtonFrameOui1.DoClick = function()
  113.     net.Start("achetersoin")
  114.     net.SendToServer()
  115.     Frame:Close()
  116.     end
  117. end
  118.    
  119. end
  120.    
  121. usermessage.Hook("NPCMEDECIN", NPCMEDECIN)
  122.  
  123.  
  124. init.lua :
  125. AddCSLuaFile( "shared.lua" )
  126. AddCSLuaFile( "cl_init.lua" )
  127.  
  128. include('shared.lua')
  129.  
  130.  
  131. function ENT:Initialize( )
  132.  
  133.     self:SetModel( "models/player/breen.mdl" ) ---model de l'addon
  134.     self:SetMoveType(MOVETYPE_NONE)
  135.     self:SetHullType( HULL_HUMAN )
  136.     self:SetHullSizeNormal( )
  137.     self:SetNPCState( 0 )
  138.     self:SetSolid(  SOLID_BBOX )
  139.     self:CapabilitiesAdd(CAP_ANIMATEDFACE)
  140.     self:SetUseType( SIMPLE_USE )
  141.     self:DropToFloor()
  142.  
  143.     self:SetMaxYawSpeed( 90 )
  144.  
  145. end
  146.  
  147. function ENT:OnTakeDamage()
  148.     return false
  149. end
  150.  
  151. function ENT:AcceptInput( Name, Activator, Caller )
  152.  
  153.     if Name == "Use" and Caller:IsPlayer() then
  154.    
  155.         umsg.Start("NPCMEDECIN", Caller)
  156.         umsg.End()
  157.    
  158.     end
  159.  
  160. end
  161.  
  162.  
  163. util.AddNetworkString("achetersoin")
  164. net.Receive( "achetersoin" , function ( len , ply )
  165.   if ply:getDarkRPVar("money") >= 100 then
  166.  
  167.    ply:addMoney( -500 )
  168.     DarkRP.notify(ply,0,7,"Vous avez fait une opération pour 250€!")
  169.     ply:SetHealth(100)
  170.       else
  171.      DarkRP.notify(ply,1,7,"Vous ne pouvez pas vous payer l'opération! (>€250)")
  172.    
  173.     end
  174.  
  175. util.AddNetworkString("achetersoin")
  176. net.Receive( "achetersoin" , function ( len , ply )
  177.   if ply:getDarkRPVar("money") >= 100 then
  178.  
  179.    ply:addMoney( -500 )
  180.     DarkRP.notify(ply,0,7,"Vous avez été juste soigner (100€)")
  181.     ply:SetHealth(100)
  182.       else
  183.      DarkRP.notify(ply,1,7,"Vous ne pouvez pas vous faire soigner (>€100)")
  184.    
  185.     end
  186.  
  187.   end)
  188.  
  189. shared .lua :
  190.  
  191. ENT.Type = "ai"
  192. ENT.Base = "base_ai"
  193. ENT.PrintName = "NPC Médecin"
  194. ENT.Author = "Stormix Red"
  195. ENT.Category    = "Tuto Youtube"
  196. ENT.Spawnable        = true
  197. ENT.AdminSpawnable    = true
  198. ENT.AutomaticFrameAdvance = true
  199.  
  200.  
  201. function ENT:SetAutomaticFrameAdvance( bUsingAnim )
  202.     self.AutomaticFrameAdvance = bUsingAnim
  203. end
  204.  
  205. function ENT:PhysicsCollide(data, physobj)
  206. end;
  207.  
  208. function ENT:PhysicsUpdate(physobj)
  209. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement