• SWEP Help
    3 replies, posted
[lua=SWEP] if SERVER then AddCSLuaFile( "shared.lua" ) end if CLIENT then SWEP.PrintName = "Mustang and Sally(WIP)" SWEP.Slot = 7 -- add 1 to get the slot number key SWEP.ViewModelFOV = 72 SWEP.ViewModelFlip = true end SWEP.Base = "weapon_tttbase" SWEP.HoldType = "fist" SWEP.Primary.Delay = 0.08 SWEP.Primary.Recoil = 1.9 SWEP.Primary.Automatic = false SWEP.Primary.Damage = 75 SWEP.Primary.Cone = 0.025 SWEP.Primary.Ammo = "smg1" SWEP.Primary.ClipSize = 4 SWEP.Primary.ClipMax = 4 SWEP.Primary.DefaultClip = 4 SWEP.Primary.Sound = Sound( "/sound/sally.wav" ) SWEP.IronSightsPos = Vector( 6.05, -5, 2.4 ) SWEP.IronSightsAng = Vector( 2.2, -0.1, 0 ) SWEP.ViewModel = "models/weapons/v_pist_elite.mdl" SWEP.WorldModel = "models/weapons/w_pist_elite.mdl" SWEP.Kind = WEAPON_EQUIP1 SWEP.AutoSpawnable = false SWEP.AmmoEnt = "none" SWEP.CanBuy = { } . SWEP.InLoadoutFor = nil SWEP.LimitedStock = false SWEP.AllowDrop = false SWEP.IsSilent = false SWEP.NoSights = true if CLIENT then SWEP.Icon = "VGUI/ttt/icon_myserver_ak47" SWEP.EquipMenuData = { type = "Weapon", desc = "You shoot bombs now. Pack a fuckin punch." }; end if SERVER then resource.AddFile("materials/VGUI/ttt/icon_myserver_ak47.vmt") end function SWEP:throw_attack(range) self.BaseClass.ShootEffects (self); if (!SERVER) then return end; local ent = ents.Create ("npc_grenade_frag"); ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 14)); ent:SetAngles (self.Owner:EyeAngles()); ent:SetOwner(self.Owner) ent:Input("settimer",self.Owner,self.Owner,"4") ent:Spawn(); local phys = ent:GetPhysicsObject(); phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * range); end function SWEP:PrimaryAttack() self:throw_attack (700); self.Weapon:SetNextPrimaryFire( CurTime() + 0.9 ) self.Owner:ViewPunch( Angle( -5, 0, 0 ) ) end [/lua] So my question is, how do I make the SWEP have limited ammo, cause for some reason it is not working. Also, how do I make it show up as the shooter doing the damage in the dlogs? And I think I may have to recode the frag itself for this, but is there any way I can make the frag explode on impact?
Weapon:TakePrimaryAmmo( num )
[QUOTE=Robotboy655;41805002]Weapon:TakePrimaryAmmo( num )[/QUOTE] Doesn't seem to work.
[QUOTE=Th3applek1d;41805261]Doesn't seem to work.[/QUOTE] You are using it incorrectly then. Look how it is done in weapon_base SWEP. You can find it in gamemodes/gamemode/base/entities/weapons/
Sorry, you need to Log In to post a reply to this thread.