• TTT Weapons fix help
    3 replies, posted
Okay so when you try and throw the frag grenade on my server it doesn't throw it, it dissapears before it even leaves your hand here is the script for it im wondering if any of you could spot an error that might be causing this problem [CODE]AddCSLuaFile() if CLIENT then SWEP.PrintName = "Frag Grenade" SWEP.Slot = 3 SWEP.Icon = "vgui/ttt/icon_nades" end -- Always derive from weapon_tttbasegrenade SWEP.Base = "weapon_tttbasegrenade" -- Standard GMod values SWEP.HoldType = "grenade" SWEP.Weight = 5 -- Model settings SWEP.UseHands = true SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 54 SWEP.ViewModel = "models/weapons/cstrike/c_eq_fraggrenade.mdl" SWEP.WorldModel = "models/weapons/w_eq_fraggrenade.mdl" --- TTT config values -- Kind specifies the category this weapon is in. Players can only carry one of -- each. Can be: WEAPON_... MELEE, PISTOL, HEAVY, NADE, CARRY, EQUIP1, EQUIP2 or ROLE. -- Matching SWEP.Slot values: 0 1 2 3 4 6 7 8 SWEP.Kind = WEAPON_NADE -- If AutoSpawnable is true and SWEP.Kind is not WEAPON_EQUIP1/2, then this gun can -- be spawned as a random weapon. SWEP.AutoSpawnable = false -- CanBuy is a table of ROLE_* entries like ROLE_TRAITOR and ROLE_DETECTIVE. If -- a role is in this table, those players can buy this. SWEP.CanBuy = { ROLE_TRAITOR } -- InLoadoutFor is a table of ROLE_* entries that specifies which roles should -- receive this weapon as soon as the round starts. In this case, none. SWEP.InLoadoutFor = { nil } -- If LimitedStock is true, you can only buy one per round. SWEP.LimitedStock = true -- If AllowDrop is false, players can't manually drop the gun with Q SWEP.AllowDrop = true -- If NoSights is true, the weapon won't have ironsights SWEP.NoSights = true function SWEP:GetGrenadeName() return "ttt_frag_proj" end -- Equipment menu information is only needed on the client if CLIENT then -- Text shown in the equip menu SWEP.EquipMenuData = { type = "Grenade", desc = "A highly explosive grenade." } end[/CODE] Also, the newton launcher in y server only pushes people a tiny bit wondering how i would change it in this script [CODE]AddCSLuaFile() SWEP.HoldType = "physgun" if CLIENT then SWEP.PrintName = "newton_name" SWEP.Slot = 7 SWEP.EquipMenuData = { type = "item_weapon", desc = "newton_desc" }; SWEP.Icon = "vgui/ttt/icon_launch" SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 54 end SWEP.Base = "weapon_tttbase" SWEP.Primary.Ammo = "none" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Delay = 3 SWEP.Primary.Ammo = "none" SWEP.Primary.Cone = 0.005 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.Secondary.Delay = 0.5 SWEP.AutoSpawnable = false SWEP.NoSights = true SWEP.Kind = WEAPON_EQUIP2 SWEP.CanBuy = {ROLE_TRAITOR} SWEP.WeaponID = AMMO_PUSH SWEP.Primary.Sound = Sound( "weapons/ar2/fire1.wav" ) SWEP.Primary.SoundLevel = 54 SWEP.UseHands = true SWEP.ViewModel = "models/weapons/c_superphyscannon.mdl" SWEP.WorldModel = "models/weapons/w_physics.mdl" AccessorFuncDT(SWEP, "charge", "Charge") SWEP.IsCharging = false SWEP.NextCharge = 0 local CHARGE_AMOUNT = 0.02 local CHARGE_DELAY = 0.025 local math = math function SWEP:Initialize() if SERVER then self:SetSkin(1) end return self.BaseClass.Initialize(self) end function SWEP:SetupDataTables() self:DTVar("Float", 0, "charge") end function SWEP:PrimaryAttack() self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self:FirePulse(600, 300) end function SWEP:SecondaryAttack() if self.IsCharging then return end self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self.IsCharging = true end function SWEP:FirePulse(force_fwd, force_up) if not IsValid(self.Owner) then return end self.Owner:SetAnimation( PLAYER_ATTACK1 ) sound.Play(self.Primary.Sound, self:GetPos(), self.Primary.SoundLevel) self:SendWeaponAnim(ACT_VM_IDLE) local cone = self.Primary.Cone or 0.1 local num = 6 local bullet = {} bullet.Num = num bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( cone, cone, 0 ) bullet.Tracer = 1 bullet.Force = force_fwd / 10 bullet.Damage = 1 bullet.TracerName = "AirboatGunHeavyTracer" local owner = self.Owner local fwd = force_fwd / num local up = force_up / num bullet.Callback = function(att, tr, dmginfo) local ply = tr.Entity if SERVER and IsValid(ply) and ply:IsPlayer() and (not ply:IsFrozen()) then local pushvel = tr.Normal * fwd pushvel.z = math.max(pushvel.z, up) ply:SetGroundEntity(nil) ply:SetLocalVelocity(ply:GetVelocity() + pushvel) ply.was_pushed = {att=owner, t=CurTime()} end end self.Owner:FireBullets( bullet ) end local CHARGE_FORCE_FWD_MIN = 300 local CHARGE_FORCE_FWD_MAX = 700 local CHARGE_FORCE_UP_MIN = 100 local CHARGE_FORCE_UP_MAX = 350 function SWEP:ChargedAttack() local charge = math.Clamp(self:GetCharge(), 0, 1) self.IsCharging = false self:SetCharge(0) if charge <= 0 then return end local max = CHARGE_FORCE_FWD_MAX local diff = max - CHARGE_FORCE_FWD_MIN local force_fwd = ((charge * diff) - diff) + max max = CHARGE_FORCE_UP_MAX diff = max - CHARGE_FORCE_UP_MIN local force_up = ((charge * diff) - diff) + max self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self:FirePulse(force_fwd, force_up) end function SWEP:PreDrop(death_drop) -- allow dropping for now, see if it helps against heisenbug on owner death -- if death_drop then self.IsCharging = false self:SetCharge(0) -- elseif self.IsCharging then -- self:ChargedAttack() -- end end function SWEP:OnRemove() self.IsCharging = false self:SetCharge(0) end function SWEP:Deploy() self.IsCharging = false self:SetCharge(0) return true end function SWEP:Holster() return not self.IsCharging end function SWEP:Think() if self.IsCharging and IsValid(self.Owner) and self.Owner:IsTerror() then -- on client this is prediction if not self.Owner:KeyDown(IN_ATTACK2) then self:ChargedAttack() return true end if SERVER and self:GetCharge() < 1 and self.NextCharge < CurTime() then self:SetCharge(math.min(1, self:GetCharge() + CHARGE_AMOUNT)) self.NextCharge = CurTime() + CHARGE_DELAY end end end if CLIENT then local surface = surface function SWEP:DrawHUD() local x = ScrW() / 2.0 local y = ScrH() / 2.0 local nxt = self:GetNextPrimaryFire() local charge = self.dt.charge if LocalPlayer():IsTraitor() then surface.SetDrawColor(255, 0, 0, 255) else surface.SetDrawColor(0, 255, 0, 255) end if nxt < CurTime() or CurTime() % 0.5 < 0.2 or charge > 0 then local length = 10 local gap = 5 surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) end if nxt > CurTime() and charge == 0 then local w = 40 w = (w * ( math.max(0, nxt - CurTime()) / self.Primary.Delay )) / 2 local bx = x + 30 surface.DrawLine(bx, y
For the frag do you have the projectile entity for it? (gamemodes/terrortown/entities/entities or lua/entities)
I don't think so no. i got this scripts from gamemodes/terrortown/entities/weapons
It should have an entity. Check the gamemodes/terrortown/entities/entities/ and see if ttt_frag_proj is in there somewhere, if it's not then you're missing the actually entity and need to find the script for it.
Sorry, you need to Log In to post a reply to this thread.