• Print

Author Topic: FastDL With Addons  (Read 5644 times)

0 Members and 1 Guest are viewing this topic.

Offline RaJiska

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
FastDL With Addons
« on: August 07, 2014, 03:34:52 pm »
Hello,

I'm new here and on the game too  :-[.
So, I would like to know how to make the client download the addon installed on the server via FastDL.
It's the Jihad Bomb for TTT. So, I placed the addon folder inside 'addons' of the server.
And then, I placed the same folder inside 'http://blah-blah.com/garrysmod/addons/' folder.

But when I join the game, it's like it doesn't download the addon I added, nothing new.
The FastDL is correctly working since maps (in 'http://blah-blah.com/garrysmod/maps/') are correctly downloaded.

Here is the code of the shared.lua:

Code: Lua
  1. if SERVER then
  2.    AddCSLuaFile( "shared.lua" );
  3.    resource.AddFile("sound/siege/jihad.wav");
  4.    resource.AddFile("sound/siege/big_explosion.wav");
  5. end
  6.  
  7. SWEP.HoldType                   = "slam"
  8.  
  9. if CLIENT then
  10.    SWEP.PrintName                       = "Jihad"
  11.    SWEP.Slot                            = 7
  12.  
  13.    SWEP.EquipMenuData = {
  14.       type  = "item_weapon",
  15.       name  = "Jihad Bomb",
  16.       desc  = "Left click goes boom!"
  17.    };
  18.  
  19.    SWEP.Icon = "VGUI/ttt/icon_c4"
  20. end
  21.  resource.AddFile("VGUI/ttt/icon_c4")
  22.  
  23.  
  24. SWEP.Base = "weapon_tttbase"
  25.  
  26. SWEP.Kind = WEAPON_EQUIP
  27. SWEP.CanBuy = {ROLE_TRAITOR}
  28. SWEP.WeaponID = AMMO_C4
  29.  
  30. SWEP.ViewModel  = Model("models/weapons/v_c4.mdl")
  31. SWEP.WorldModel = Model("models/weapons/w_c4.mdl")
  32. resource.AddFile("models/weapons/v_c4.mdl")
  33. resource.AddFile("models/weapons/w_c4.mdl")
  34.  
  35.  
  36. SWEP.DrawCrosshair          = false
  37. SWEP.ViewModelFlip          = false
  38. SWEP.Primary.ClipSize       = -1
  39. SWEP.Primary.DefaultClip    = -1
  40. SWEP.Primary.Automatic      = false
  41. SWEP.Primary.Ammo           = "none"
  42. SWEP.Primary.Delay          = 5.0
  43.  
  44. SWEP.Secondary.ClipSize     = -1
  45. SWEP.Secondary.DefaultClip  = -1
  46. SWEP.Secondary.Automatic    = false
  47. SWEP.Secondary.Ammo         = "none"
  48.  
  49. SWEP.NoSights               = true
  50.  
  51.  
  52.  
  53. function SWEP:Reload()
  54. end  
  55.  
  56. function SWEP:Initialize()
  57.     util.PrecacheSound("siege/big_explosion.wav")
  58.     util.PrecacheSound("siege/jihad.wav")
  59. end
  60.  
  61.  
  62. function SWEP:Think()  
  63. end
  64.  
  65.  
  66.  
  67. function SWEP:PrimaryAttack()
  68.   self.Weapon:SetNextPrimaryFire(CurTime() + 2)    
  69.  
  70.   local effectdata = EffectData()
  71.   effectdata:SetOrigin( self.Owner:GetPos() )
  72.   effectdata:SetNormal( self.Owner:GetPos() )
  73.   effectdata:SetMagnitude( 8 )
  74.   effectdata:SetScale( 1 )
  75.   effectdata:SetRadius( 76 )
  76.   util.Effect( "Sparks", effectdata )
  77.   self.BaseClass.ShootEffects( self )
  78.        
  79.   -- The rest is only done on the server
  80.   if (SERVER) then
  81.     timer.Simple(2, function() self:Asplode() end )
  82.     self.Owner:EmitSound( "siege/jihad.wav" )
  83.   end
  84. end
  85.  
  86.  
  87. function SWEP:Asplode()
  88.   local k, v
  89.            
  90.   local ent = ents.Create( "env_explosion" )
  91.   ent:SetPos( self.Owner:GetPos() )
  92.   ent:SetOwner( self.Owner )
  93.   ent:SetKeyValue( "iMagnitude", "150" )
  94.   ent:Spawn()
  95.   ent:Fire( "Explode", 0, 0 )
  96.   ent:EmitSound( "siege/big_explosion.wav", 500, 500 )
  97.   self:Remove()
  98. end
  99.  
  100.  
  101.  
  102. function SWEP:SecondaryAttack()
  103.   self.Weapon:SetNextSecondaryFire( CurTime() + 1 )
  104.   local TauntSound = Sound( "vo/npc/male01/overhere01.wav" )
  105.   self.Weapon:EmitSound( TauntSound )
  106. end

The structure of the addon:

Code: [Select]
TTT Jihad Bomb/
??? addon.txt
??? lua
?   ??? weapon_ttt_jihad
?       ??? shared.lua
??? materials
    ??? VGUI
        ??? ttt
            ??? icon_c4.vmt
Thanks for your help.
« Last Edit: August 08, 2014, 01:48:00 am by RaJiska »

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: FastDL With Addons
« Reply #1 on: August 08, 2014, 09:52:13 am »
You don't put the "addons" folder into the fast DL. The addons structure for Garry's Mod is just a cleaner way of adding "features" without having to put materials in materials, models in models etc when adding weapons and so on.

What you'd need to do is, it to put the contents of the "materials" folder in http://blah-blah.com/garrysmod/materials/'.

Also, I'm pretty sure you have to put the "weapon_ttt_jihad" folder inside "gamemodes/terrortown/entities/weapons/" on your server, unless TTT actually checks the "addons" folder for weapons and such.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline RaJiska

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: FastDL With Addons
« Reply #2 on: August 08, 2014, 10:10:02 am »
What you'd need to do is, it to put the contents of the "materials" folder in http://blah-blah.com/garrysmod/materials/'.

Effectively, I looked again on the TTT website and it seems weapon have to be added somewhere else.
I'll check if I can get it working, thanks.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: FastDL With Addons
« Reply #3 on: August 08, 2014, 12:38:51 pm »
For TTT, they are placed in gamemode/terrortown/entities/weapons.
Out of the Garry's Mod business.

  • Print