Hey, I am trying to convert a Rainbow Shotgun weapon designed for Sandbox to TTT for a server I run. I have extracted the files into a folder and placed it in both the "addons" and "gamemodes/terrortown/entities/weapons". I have attempted to change it to work for TTT, and below is the coding of the shared.lua file. If anyone can help me fix it or tell me how, that would be nice!
[code]if ( CLIENT ) then
SWEP.Slot = 2
SWEP.SlotPos = 5
killicon.Add( "weapon_rainbowshotgun", "laser/killicon", color_white )
SWEP.BounceWeaponIcon = false
SWEP.DrawWeaponInfoBox = false
end
reloading = false
pumptime = 0
pump = false
reloadamount = 0
local IRONSIGHT_TIME = 0.25
//General Settings \\
SWEP.AdminSpawnable = true // Is the swep spawnable for admin
SWEP.ViewModelFOV = 60 // How much of the weapon do u see ?
SWEP.ViewModel = "models/weapons/c_shotgun.mdl" // The viewModel, the model you se when you are holding it-.-
SWEP.WorldModel = "models/weapons/w_shotgun.mdl" // The worlmodel, The model yu when it's down on the ground
SWEP.AutoSwitchTo = false // when someone walks over the swep, chould i automatectly change to your swep ?
SWEP.Slot = 3 // Deside wich slot you want your swep do be in 1 2 3 4 5 6
SWEP.HoldType = "pistol" // How the swep is hold Pistol smg greanade melee
SWEP.PrintName = "Rainbow Shotgun" // your sweps name
SWEP.Author = "BurpeeBoy" // Your name
SWEP.Spawnable = false // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true.
SWEP.AutoSwitchFrom = false // Does the weapon get changed by other sweps if you pick them up ?
SWEP.FiresUnderwater = false // Does your swep fire under water ?
SWEP.Weight = 5 // Chose the weight of the Swep
SWEP.DrawCrosshair = true // Do you want it to have a crosshair ?
SWEP.Category = "BurpeeBoy" // Make your own catogory for the swep
SWEP.SlotPos = 3 // Deside wich slot you want your swep do be in 1 2 3 4 5 6
SWEP.DrawAmmo = true // Does the ammo show up when you are using it ? True / False
SWEP.ReloadSound = "Weapon_Pistol.Reload" // Reload sound, you can use the default ones, or you can use your one; Example; "sound/myswepreload.waw"
SWEP.Instructions = "Left Click = Shoot" // How do pepole use your swep ?
SWEP.Contact = "" // How Pepole chould contact you if they find bugs, errors, etc
SWEP.Purpose = "" // What is the purpose with this swep ?
SWEP.DrawCrosshair = true
SWEP.UseHands = true
//General settings\\
//PrimaryFire Settings\\
SWEP.Primary.Sound2 = "weapons/weapon_lasershotgun/blast.wav" // The sound that plays when you shoot :]
SWEP.Primary.Sound = "weapons/weapon_lasershotgun/explode.wav"
SWEP.Primary.PumpSound = "weapons/shotgun/shotgun_cock.wav"
SWEP.Primary.Damage = 500 // How much damage the swep is doing
SWEP.Primary.TakeAmmo = 0 // How much ammo does it take for each shot ?
SWEP.Primary.ClipSize = 10 // The clipsize
SWEP.Primary.Ammo = "buckshot" // ammmo type pistol/ smg1
SWEP.Primary.DefaultClip = 10 // How much ammo does the swep come with `?
SWEP.Primary.Spread = 1 // Does the bullets spread all over, if you want it fire exactly where you are aiming leave it o.1
SWEP.Primary.NumberofShots = 25 // How many bullets you are firing each shot.
SWEP.Primary.Automatic = false // Is the swep automatic ?
SWEP.Primary.Recoil = 10 // How much we should punch the view
SWEP.Primary.Delay = 1 // How long time before you can fire again
SWEP.Primary.Force = 10 // The force of the shot
//PrimaryFire settings\\
function SWEP:Initialize()
util.PrecacheSound(self.Primary.Sound)
if ( SERVER ) then
self:SetWeaponHoldType( self.HoldType )
end
end
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local bullet = {}
bullet.Num = self.Primary.NumberofShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 1
bullet.TracerName = "laser_tracer"
bullet.Force = self.Primary.Force
bullet.Damage = self.Primary.Damage
bullet.AmmoType = self.Primary.Ammo
local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)
self:ShootEffects()
self.Owner:FireBullets( bullet )
self.Weapon:EmitSound(Sound(self.Primary.Sound))
self.Weapon:EmitSound(Sound(self.Primary.Sound2))
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
self:TakePrimaryAmmo(self.Primary.TakeAmmo)
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
pumptime = CurTime() + (self.Primary.Delay/2)
pump = true
end
function SWEP:Reload()
if ( self:Clip1() < self.Primary.ClipSize and self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 ) then
if reload then return end
proposedreload = self.Primary.ClipSize - self:Clip1()
reload = true
if (self:Clip1() == 0) then
emptyclip = true
end
end
end
function SWEP:Think()
if ( pump == true && pumptime <= CurTime() ) then
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP )
self.Weapon:EmitSound(Sound(self.Primary.PumpSound))
pump = false
end
if !reload then return end
if ( reloadamount < proposedreload ) then
if ( self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 ) then
self:DefaultReload( ACT_VM_RELOAD )
reloadamount = reloadamount + 1
self.Weapon:EmitSound(Sound("weapons/stunstick/stunstick_impact2.wav"))
if !emptyclip then
self:TakePrimaryAmmo( -1 )
self:TakeSecondaryAmmo(1)
end
end
else
reload = false
reloadamount = 0
proposedreload = 0
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP )
self.Weapon:EmitSound(Sound(self.Primary.PumpSound))
end
end
function SWEP:SecondaryAttack()
end
if ( SERVER ) then return end
--------------------------------------------------------------------------------------
local EFFECT = {}
local Laser = Material( "laser/laser" )
function EFFECT:Init( data )
self.StartPos = data:GetStart()
self.Direction = data:GetOrigin()
self.Dist = math.random( 32, 64 )
self.EndPos = self.StartPos + self.Direction * self.Dist
self:SetRenderBoundsWS( self.StartPos, self.EndPos )
self.LifeTime = 1
self.DieTime = CurTime() + self.LifeTime
end
function EFFECT:Think()
if ( CurTime() > self.DieTime ) then return false end
return true
end
function EFFECT:Render()
local v1 = ( CurTime() - self.DieTime ) / self.LifeTime
local v2 = ( self.DieTime - CurTime() ) / self.LifeTime
local a = self.EndPos + self.Direction * math.min( v1 * self.Dist, 0 )
render.SetMaterial( Laser )
render.DrawBeam( self.StartPos, a, v2 * 6, 0, self.StartPos:Distance( self.EndPos ) / 10, Color( 255, 255, 255, v2 * 255 ) )
render.SetMaterial( Laser )
render.DrawBeam( a + self.Direction * 8, a + self.Direction * -8, 16, 0, 1, Color( 255, 255, 255, math.min( ( v2 * 3 ) * 200, 255 ) ) )
end
effects.Register
Are there any errors?
Put SWEP.Base = "weapon_tttbase" in there.
I just checked my server console, and, no there aren't any errors.
[QUOTE=code_gs;45237947]Put SWEP.Base = "weapon_tttbase" in there.[/QUOTE]
I already have that added?
[code]// TTT \\
SWEP.Base = "weapon_tttbase"
SWEP.Kind = WEAPON_HEAVY
SWEP.AmmoEnt = "item_ammo_smg1_ttt"
SWEP.AutoSpawnable = true
SWEP.InLoadoutFor = nil
SWEP.AllowDrop = true
SWEP.IsSilent = false
SWEP.NoSights = true[/code]
Then it should work.
[QUOTE=code_gs;45238535]Then it should work.[/QUOTE]
Yeah, I'm relatively new to weapon converting, but I don't think there's anything wrong with it. Where do I have to put the extracted folders? I put the folder both in the SERVER/garrysmod/addons folder and the SERVER/garrysmod/gamemodes/terrortown/entities/weapons folders. Do I have to copy the shared.lua and add it with all the other .lua files that appear in the weapons folder? (instead of in just its own folder). Whenever I spawn it in, I can't pick it up, like a normal sandbox weapon would do.
bump
Dont bump, you will get banned.
So what other files came with it? The shared.lua should be fine in terrortown/entities/weapons.
Sorry, you need to Log In to post a reply to this thread.