Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.85 KB | None | 0 0
  1. local plr = LocalPlayer()
  2. if( SERVER ) then
  3.     AddCSLuaFile( "shared.lua" )
  4.     SWEP.Weight = 50
  5.     SWEP.AutoSwitchTo = false
  6.     SWEP.AutoSwitchFrom = false
  7.     function DisguiseMDL(player,commands,args)
  8.         if type(args[1]) != "string" then return end
  9.         if args[1] != "models/player/arctic.mdl" then
  10.             Disguise = true
  11.         end
  12.         util.PrecacheModel( args[1] )
  13.         player:SetModel( args[1] )
  14.     end
  15.     concommand.Add("disguise_mdl",DisguiseMDL)
  16.    
  17.     function PlayerDeath(victim,weapon,killer)
  18.         if killer == plr then
  19.             umsg.Start("PlayerGotKilled",killer)
  20.                 umsg.Entity(killer)
  21.             umsg.End()
  22.         end
  23.     end
  24.     hook.Add("PlayerDeath","afolafhaflhu",PlayerDeath)
  25. end
  26.  
  27. if( CLIENT ) then
  28.     SWEP.PrintName  = "Disguise Kit"
  29.     SWEP.Slot   = 0
  30.     SWEP.SlotPos    = 3
  31.     SWEP.DrawAmmo   = false
  32.     SWEP.DrawCrosshair = false
  33.                         --Thief                         Gangster                        Cop                             Citizen(lol?)
  34.     local GMdl = {"models/player/barney.mdl","models/player/group03/male_01.mdl","models/player/police.mdl","models/player/group01/male_01.mdl"}
  35.     function DisguiseMenu()
  36.         --Menu code, hacked from DarkRP.
  37.         local frame = vgui.Create( "DFrame" )
  38.             frame:SetTitle( "Choose disguise" )
  39.             frame:SetVisible(true)
  40.             frame:MakePopup()
  41.                        
  42.         local levels = 1
  43.         local IconsPerLevel = math.floor(ScrW()/64)
  44.                        
  45.         while #GMdl * (64/levels) > ScrW() do
  46.             levels = levels + 1
  47.         end
  48.         frame:SetSize(math.Min(#GMdl * 64, IconsPerLevel*64), math.Min(90+(64*(levels-1)), ScrH()))
  49.         frame:Center()
  50.                        
  51.         local CurLevel = 1
  52.         for k,v in pairs(GMdl) do
  53.             local icon = vgui.Create("SpawnIcon", frame)
  54.             if (k-IconsPerLevel*(CurLevel-1)) > IconsPerLevel then
  55.                 CurLevel = CurLevel + 1
  56.             end
  57.             icon:SetPos((k-1-(CurLevel-1)*IconsPerLevel) * 64, 25+(64*(CurLevel-1)))
  58.             icon:SetModel(v)
  59.             icon:SetIconSize(64)
  60.             icon:SetToolTip()
  61.             icon.DoClick = function()
  62.                
  63.                 RunConsoleCommand("disguise_mdl",v)
  64.                 frame:Close()
  65.             end
  66.         end
  67.     end
  68.     usermessage.Hook("OpenDisguiseGUI",DisguiseMenu)
  69.     function PlayerDead(msg)
  70.         person = msg:ReadEntity()
  71.         if person == LocalPlayer() then
  72.             RunConsoleCommand("disguise_mdl","models/player/arctic.mdl")
  73.         end
  74.     end
  75.     usermessage.Hook("PlayerGotKilled",PlayerDead)
  76. end
  77.  
  78. SWEP.Base       = "weapon_base"
  79.  
  80. SWEP.Author     = "Meoowe(SWEP), Rifleman223(GUI)"
  81. SWEP.Instructions   = "Primary Fire : Open Disguise Menu \n Secondary Fire : Toggle Cloak \n Reload : Undisguise"
  82. SWEP.Contact        = ""
  83. SWEP.Purpose        = ""
  84. SWEP.Spawnable      = true
  85. SWEP.AdminSpawnable = true
  86.  
  87.  
  88. SWEP.Primary.ClipSize = -1
  89. SWEP.Primary.DefaultClip = -1
  90. SWEP.Primary.Automatic = false
  91. SWEP.Primary.Ammo = "none"
  92. SWEP.Secondary.ClipSize = -1
  93. SWEP.Secondary.DefaultClip = -1
  94. SWEP.Secondary.Automatic = false
  95. SWEP.Secondary.Ammo = "none"
  96.  
  97. SWEP.ViewModel      = ""
  98. SWEP.WorldModel   = "models/weapons/w_package.mdl"
  99.  
  100. function SWEP:Initialize()
  101.     if( SERVER ) then
  102.         self:SetWeaponHoldType( "slam" )
  103.     end
  104. end
  105. Disguise = false
  106. local plr
  107. function SWEP:PrimaryAttack()
  108.     plr = self.Owner
  109.     if( SERVER )then   
  110.         umsg.Start("OpenDisguiseGUI",plr)
  111.         umsg.End()
  112.     end
  113. end
  114.     --util.PrecacheModel( "models/player/"..Mdl..".mdl" )
  115.     --self.Owner:SetModel( "models/player/"..Mdl..".mdl" )
  116.  
  117. conceal = false
  118. function SWEP:SecondaryAttack()
  119.     if ( !conceal ) then
  120.         self.Owner:SetColor( 0, 0, 0, 0, 50 )
  121.         self.Weapon:SetColor( 0, 0, 0, 0, 50 )
  122.         self.Owner:PrintMessage( HUD_PRINTCENTER, "Invisible" )
  123.         conceal = true
  124.     else
  125.         self.Owner:SetColor( 255, 255, 255, 255 )
  126.         self.Weapon:SetColor( 255, 255, 255 )
  127.         self.Owner:PrintMessage( HUD_PRINTCENTER, "Visible" )
  128.         conceal = false
  129.     end
  130.  
  131. end
  132.  
  133. function SWEP:Reload()
  134.     if CLIENT then
  135.         Disguise = false
  136.         RunConsoleCommand("disguise_mdl","models/player/arctic.mdl")
  137.     end
  138. end
  139.        
  140. function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )  
  141.     draw.SimpleText( "H", "CSSelectIcons", x + wide/2, y + tall*0.2, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
  142. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement