Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile()
- sound.Add( {
- name = "paintball_equip",
- channel = CHAN_STATIC,
- volume = 1.0,
- level = 80,
- pitch = {98, 102},
- sound = "phx/paintball_pickup_02.wav"
- } )
- sound.Add( {
- name = "paintball_unequip",
- channel = CHAN_STATIC,
- volume = 1.0,
- level = 80,
- pitch = {98, 102},
- sound = "phx/paintball_drop_02.wav"
- } )
- sound.Add( {
- name = "paintball_dry",
- channel = CHAN_STATIC,
- volume = 1.0,
- level = 80,
- pitch = {95, 110},
- sound = "phx/paintball_gun_dry_fire_01.wav"
- } )
- sound.Add( {
- name = "paintball_switch",
- channel = CHAN_STATIC,
- volume = 2.0,
- level = 80,
- pitch = {95, 110},
- sound = "phx/paintball_gun_switch_power_feedback_01.wav"
- } )
- --myMat:SetVector("$color",Vector(1,1,1))
- SWEP.PrintName = "Paintinator"
- SWEP.Author = "Dogeiscut"
- SWEP.Contact = "On steam"
- SWEP.Purpose = "Paintballs apply knockback and paint objects smaller than 2500 with your weapon color."
- SWEP.Category = "DogeisCut's SWEPs"
- SWEP.Base = "weapon_base"
- SWEP.Instructions = [[Left-Click: Fires Paintballls
- Right-Click: Dry Fire]]
- --Right-Click: Same as left click, but using Shirt Color instead]]
- SWEP.IconOverride = "materials/entities/weapon_paintinator.jpg"
- --[[
- print(Material("entities/weapon_paintinator_selecticon.png"))
- function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
- -- Set us up the texture
- surface.SetDrawColor(255, 255, 255, alpha)
- surface.SetMaterial(Material("entities/weapon_paintinator_selecticon.png"))
- surface.DrawTexturedRect( x + wide/4, y+20, ( wide / 2), ( wide / 2 ))
- end
- ]]--
- SWEP.ViewModel = "models/weapons/c_paintinator.mdl"
- SWEP.ViewModelFlip = false
- SWEP.UseHands = true
- SWEP.WorldModel = "models/weapons/w_paintinator.mdl"
- SWEP.SetHoldType = "pistol"
- SWEP.Weight = 5
- SWEP.AutoSwitchTo = true
- SWEP.AutoSwitchFrom = false
- SWEP.Slot = 1
- SWEP.SlotPos = 0
- SWEP.DrawAmmo = false
- SWEP.DrawCrossHair = true
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = false
- SWEP.Primary.ClipSize = math.inf
- SWEP.Primary.Sound = Sound("none")
- SWEP.Primary.DefaultClip = math.inf
- SWEP.Primary.Ammo = "none"
- --SWEP.Primary.TakeAmmo = 1
- SWEP.Primary.Automatic = false
- SWEP.Mode = 0
- SWEP.Secondary.ClipSize = -1
- SWEP.Secondary.DefaultClip = -1
- SWEP.Secondary.Ammo = "none"
- SWEP.Secondary.Automatic = false
- SWEP.ShouldDropOnDie = true
- sent_paintball = {}
- sent_paintball.plyColor = Color(255,255,255,255)
- function SWEP:SecondaryAttack()
- util.AddNetworkString( "ChosenPaintinatorColor" )
- self:SendWeaponAnim( ACT_VM_RELOAD )
- self.Owner:SetAnimation( PLAYER_RELOAD )
- --self:EmitSound("paintball_dry")
- self:EmitSound("paintball_switch")
- self:CallOnClient("SecondaryAttackClient", "")
- end
- function SWEP:SecondaryAttackClient()
- local frame = vgui.Create( "DFrame" )
- frame:SetSize( 500, 300 )
- frame:Center()
- frame:MakePopup()
- frame:SetDraggable( false )
- local DermaColorCombo = vgui.Create( "DColorCombo", frame )
- DermaColorCombo:SetPos( 5, 30 )
- DermaColorCombo:SetColor( sent_paintball.plyColor )
- local DColorButton = frame:Add( "DColorButton" )
- DColorButton:SetPos( 300, 50 )
- DColorButton:SetSize( 64, 64 )
- DColorButton:SetColor( sent_paintball.plyColor )
- function DermaColorCombo:OnValueChanged( col )
- DColorButton:SetColor( col )
- sent_paintball.plyColor = Color(col.r,col.g,col.b,255)
- end
- end
- function SWEP:Deploy()
- self:EmitSound("paintball_equip")
- --[[
- if self.Owner:IsPlayer() then
- do
- sent_paintball.plyColorR = math.Clamp(self.Owner:GetWeaponColor()[1]*255,0,255)
- sent_paintball.plyColorG = math.Clamp(self.Owner:GetWeaponColor()[2]*255,0,255)
- sent_paintball.plyColorB = math.Clamp(self.Owner:GetWeaponColor()[3]*255,0,255)
- sent_paintball.plyColor = Color(sent_paintball.plyColorR,sent_paintball.plyColorG,sent_paintball.plyColorB,255)
- end
- end
- --]]
- return true
- end
- function SWEP:Holster()
- self:EmitSound("paintball_unequip")
- return true
- end
- function SWEP:PrimaryAttack()
- print(sent_paintball.plyColor)
- if ( !self:CanPrimaryAttack() ) then return end
- local ply = self.Owner
- local aim = self.Owner:GetAimVector()
- local side = aim:Cross(Vector(0,0,1))
- local up = side:Cross(aim)
- local pos = self.Owner:GetShootPos() + aim * 0 + side * 8 + up * -8
- if SERVER then
- local paint = ents.Create("sent_paintball")
- paint:SetPos(pos)
- paint:SetAngles(ply:EyeAngles())
- paint:SetOwner(ply)
- paint:SetColor(sent_paintball.plyColor)
- paint:Spawn()
- paint:GetPhysicsObject():SetVelocity(ply:GetAimVector()*3000)
- end
- self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
- --self:TakePrimaryAmmo( 1 )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement