Advertisement
Guest User

weapon_ak47custom\shared.lua

a guest
Feb 21st, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.81 KB | None | 0 0
  1. --[[---------------------------------------------------------------------------
  2. Here's an example weapon that you can edit
  3. ---------------------------------------------------------------------------]]
  4. AddCSLuaFile()
  5.  
  6. if CLIENT then
  7.     SWEP.PrintName = "AK47" -- The name that shows in the scroll menu and when you hover over the gun in the q-menu.
  8.     SWEP.Author = "DarkRP Developers and Ralph Drake" -- Author Name.
  9.     SWEP.Slot = 3 -- In which tab in the scroll menu the weapon shows up in. 1 being the far left and 9 being the farthest right.
  10.     SWEP.SlotPos = 0 -- If you have 300 weapons all in the same slot you could organize each of them with a uniqe number all the way up to 300. Would keep it organized...I guess.
  11.     SWEP.IconLetter = "b"
  12.  
  13.     killicon.AddFont("weapon_ak47custom", "CSKillIcons", SWEP.IconLetter, Color(255, 80, 0, 255))
  14.     -- If you were to change the above folder name you would change the kill icon as well.
  15.  
  16. end
  17.  
  18. SWEP.Base = "weapon_cs_base2" -- If you dont plan to use weapons from the workshop this wont matter much.
  19.  
  20. SWEP.Spawnable = true -- If the weapon can be spawned.
  21. SWEP.AdminSpawnable = true -- If Admins can spawn this.
  22. SWEP.Category = "DarkRP (Weapon)" -- Defines where the weapon will be grouped in the q-menu->weapons tab. Can be anything you like. (Case sensitive!)
  23. SWEP.SpawnMenuIcon = "vgui/entities/weapon_ak472"
  24. SWEP.BounceWeaponIcon = false
  25. -- For custom weapons you can create new icons by going to the materials folder of the addon and creating an entities folder
  26. -- and creating a png inside with the dimensions of 128x128 and have the name of the file match the name of the weapons folder name.
  27. -- The above icon uses an older style of achieving the same goal.
  28.  
  29. SWEP.UseHands = true -- Use the hands of your playermodel if the playermodel supports it.
  30. SWEP.ViewModel = "models/weapons/view/rifles/ak47.mdl" -- The players point of view.
  31. SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl" -- The point of view others have when looking at the player holding the gun.
  32. -- SWEP.WorldModel = "models/weapons/w_ak47.mdl"
  33.  
  34. SWEP.Weight = 5
  35. SWEP.AutoSwitchTo = false -- When you pick it up should you auto switch to the gun?
  36. SWEP.AutoSwitchFrom = false -- When you pick something else up should you switch away from what you are holding?
  37.  
  38. SWEP.HoldType = "ar2" -- This is how others view you carrying the weapon. Options include:
  39. -- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive
  40. -- You're mostly going to use ar2, smg, shotgun or pistol. rpg and crossbow make for good sniper rifles
  41.  
  42. SWEP.Primary.Sound = Sound("weapons/ak47/ak47_fire1.wav") -- The sound that is played while shooting. You can setup a sound file externally or you can paste the path to any type of sound file on your server.
  43. SWEP.Primary.Recoil = 1.3   -- How much the gun will jump while shooting.
  44. SWEP.Primary.Damage = 34    -- How much it will hurt every time a bullet hits its target.
  45. SWEP.Primary.NumShots = 1   -- How many bullets come out every time you shoot. Anything higer than 1 would probably be a shotgun.
  46. SWEP.Primary.Cone = 0.002   -- How accurate the gun will be. Think "CSGO" when it comes to the weapon spread, thats this.
  47. SWEP.Primary.ClipSize = 30  -- How much ammo can you hold in the clip at one time.
  48. SWEP.Primary.Delay = 0.1    -- A delay between shots. Effects fire speed.
  49. SWEP.Primary.DefaultClip = 30 -- How much ammo you spawn with.
  50. SWEP.Primary.Automatic = true -- Is the gun Semi-Automatic or Fully Automatic? True for Full; False for Semi.
  51. SWEP.Primary.Ammo = "ar2" -- What kind of ammo.  Options, besides custom, include pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, and AirboatGun.
  52. --Pistol, buckshot, and slam like to ricochet. Use AirboatGun for a light metal peircing shotgun pellets
  53.  
  54. SWEP.Secondary.ClipSize = -1 -- How much ammo you have for your secondary fire. Since this weapon doesnt have a secondary fire its set to -1
  55. SWEP.Secondary.DefaultClip = -1 -- How much ammo you would spawn with for your secondary fire.
  56. SWEP.Secondary.Automatic = false -- If your secondary fire is automatic or semi-automatic.
  57. SWEP.Secondary.Ammo = "none" -- What type of ammo your secondary fire takes. If you dont have a secondary fire make sure to set this to none.
  58.  
  59. SWEP.IronSightsPos = Vector(-2.201, -4.646, 0.675) -- Where the gun locks into place when aiming.
  60. SWEP.IronSightsAng = Vector(-0.64, 0, 0) -- Vector(0.264, 0, 0) -- Where the gun locks into place when aiming.
  61.  
  62. -- SWEP.MultiMode = true
  63.  
  64. SWEP.Anims = {}
  65. SWEP.Anims.Reload = "reload"
  66.  
  67. function SWEP:Reload()
  68.     -- local sequence = self:LookupSequence( "reload" )
  69.     if CLIENT then
  70.         self.CurAnim = "reload"
  71.  
  72.         self.Weapon:SetCycle( 0 )
  73.         self.Weapon:SetSequence( self.Anims.Reload )
  74.         self.Weapon:SetPlaybackRate( 1 )
  75.     end
  76.  
  77.     self.Owner:SetAnimation(PLAYER_RELOAD)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement