• Weapon that changes your bodygroups
    1 replies, posted
Hi, i'm using this code to make weapon but it is not working. In my opinion the problem is in the last function that actually change your bodygroups. What function should i use to do like after clicking left mouse button on weapon it changes your bodygroups? And is it possible to make weapon change bodygroup by clicking LMB and then by clicking RMB it will change your bodygroup to first? AddCSLuaFile() if CLIENT then SWEP.PrintName            = "Weapon"             SWEP.Slot                = 2 SWEP.SlotPos            = 0 SWEP.DrawCrosshair        = false end SWEP.Author        = "Author" SWEP.Contact        = "" SWEP.Purpose        = "..." SWEP.Instructions    = "" SWEP.ViewModel        = "models/props_lab/clipboard.mdl" SWEP.WorldModel        = "models/props_lab/clipboard.mdl" SWEP.Weight                = 5 SWEP.AutoSwitchTo        = false SWEP.AutoSwitchFrom        = false SWEP.HoldType            = "normal" SWEP.AnimPrefix = "normal" SWEP.Spawnable            = true SWEP.AdminSpawnable        = true SWEP.Category = "Other" SWEP.Primary.ClipSize        = -1 SWEP.Primary.DefaultClip    = -1 SWEP.Primary.Automatic        = false SWEP.Primary.Ammo            = "none" SWEP.Secondary.ClipSize        = -1 SWEP.Secondary.DefaultClip    = -1 SWEP.Secondary.Automatic    = false SWEP.Secondary.Ammo            = "none" function SWEP:Initialize()     self:SetHoldType( "normal" ) end function SWEP:Deploy()     if CLIENT then         if IsValid(LocalPlayer())then                local Viewmodel = LocalPlayer():GetViewModel()             if IsValid(Viewmodel) then                 Viewmodel:SetMaterial("models/clipboard")             end         end     end     return true     end function SWEP:Holster()     if CLIENT then         if IsValid(LocalPlayer()) then                   local Viewmodel = LocalPlayer():GetViewModel()             if IsValid(Viewmodel) then                 Viewmodel:SetMaterial("")             end         end     end     return true end function SWEP:PrimaryAttack()         if SERVER then         Player = function(ply)    ply:SetBodygroup(1,0)    ply:SetBodygroup(2,4)    ply:SetBodygroup(3,0)      end    end  end
[lua]function SWEP:PrimaryAttack()         if SERVER then         local ply = self.Owner         ply:SetBodygroup(1,0)         ply:SetBodygroup(2,4)         ply:SetBodygroup(3,0)     end end[/lua]
Sorry, you need to Log In to post a reply to this thread.