nrich588
Poster
Posts: 253
WzG Owner
|
|
« on: December 17, 2011, 10:24:48 PM » |
|
For some reason, my server won't make clients download VGUI for Weapons, so I just get the ugly pink and black squares. I made sure the names for the icons were unique, and I restarted my server after adding them, and they didn't download. Maybe I'm adding them to the wrong directory? terrortown/content/materials/vgui/ttt/ terrortown/content/materials/VGUI/ttt/ wasn't sure which one but this is the swep code for my jihad bomb that won't show the icon: if SERVER then AddCSLuaFile( "shared.lua" ) end
SWEP.Weight = 5 SWEP.PrintName = "Jihad Bomb" SWEP.Slot = 6 SWEP.SlotPos = 1 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false SWEP.ViewModelFlip = false
SWEP.HoldType = "slam" if CLIENT then SWEP.Icon = "VGUI/ttt/icon_sgjihad" end
--Bewm function SWEP:WorldBoom() surface.EmitSound( "siege/big_explosion.wav" )
end
SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.DrawCrosshair = false
SWEP.Spawnable = true SWEP.AdminSpawnable = true // Spawnable in singleplayer or by server admins
SWEP.Base = "weapon_tttbase"
SWEP.ViewModel = "models/weapons/v_c4.mdl" SWEP.WorldModel = "models/weapons/w_c4.mdl"
SWEP.Kind = WEAPON_EQUIP1 SWEP.CanBuy = { ROLE_TRAITOR } SWEP.LimitedStock = false
if SERVER then resource.AddFile("materials/VGUI/ttt/icon_sgjihad.vmt") end SWEP.EquipMenuData = { type = "Weapon", desc = "Using will award you with 72 \n virgins." };
SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Primary.Delay = 3
SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none"
/*--------------------------------------------------------- Reload does nothing ---------------------------------------------------------*/ function SWEP:Reload() end
function SWEP:Initialize() util.PrecacheSound("siege/big_explosion.wav") util.PrecacheSound("siege/jihad.wav") end
/*--------------------------------------------------------- Think does nothing ---------------------------------------------------------*/ function SWEP:Think() end
/*--------------------------------------------------------- PrimaryAttack ---------------------------------------------------------*/ function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + 3)
self.AllowDrop = false
local effectdata = EffectData() effectdata:SetOrigin( self.Owner:GetPos() ) effectdata:SetNormal( self.Owner:GetPos() ) effectdata:SetMagnitude( 8 ) effectdata:SetScale( 1 ) effectdata:SetRadius( 16 ) util.Effect( "Sparks", effectdata ) self.BaseClass.ShootEffects( self ) // The rest is only done on the server if (SERVER) then timer.Simple(2, function() self:Asplode() end ) self.Owner:EmitSound( "siege/jihad.wav" ) end
end
--The asplode function function SWEP:Asplode() local k, v // Make an explosion at your position local ent = ents.Create( "env_explosion" ) ent:SetPos( self.Owner:GetPos() ) ent:SetOwner( self.Owner ) ent:Spawn() ent:SetKeyValue( "iMagnitude", "250" ) ent:Fire( "Explode", 0, 0 ) ent:EmitSound( "siege/big_explosion.wav" ) self.Owner:Kill() for k, v in pairs( player.GetAll( ) ) do v:ConCommand( "play siege/big_explosion.wav\n" ) end self:Remove()
end
/*--------------------------------------------------------- SecondaryAttack ---------------------------------------------------------*/ function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire( CurTime() + 1 ) local TauntSound = Sound( "vo/npc/Alyx/ohno_startle01.wav" )
self.Weapon:EmitSound( TauntSound ) // The rest is only done on the server if (!SERVER) then return end self.Weapon:EmitSound( TauntSound )
end
|
|
|
|
Mr. Gash
Poster
Posts: 382
www.nonerdsjustgeeks.com
|
|
« Reply #1 on: December 17, 2011, 10:36:29 PM » |
|
Getting the same issue.
(And interestingly enough with the Jihad bomb, too.)
|
|
|
|
nrich588
Poster
Posts: 253
WzG Owner
|
|
« Reply #2 on: December 17, 2011, 10:46:02 PM » |
|
maybe if I place it in another folder? Ill give it a try in the Global Materials folder (Garrysmod/materials) see how that works.
I think thats where the SWep Checks in Garrysmod Folder for custom icons.
|
|
« Last Edit: December 17, 2011, 10:49:15 PM by nrich588 »
|
|
|
|
nrich588
Poster
Posts: 253
WzG Owner
|
|
« Reply #3 on: December 18, 2011, 12:27:09 AM » |
|
I was correct, move custom icons into your materials folder
|
|
|
|
sniperduck
Poster
Posts: 178
|:NxS:| Staff! :D
|
|
« Reply #4 on: December 18, 2011, 01:31:16 AM » |
|
I was correct, move custom icons into your materials folder
Oh thats what you were talking about yesterday. I thought you were talking about within the code not file location.
|
Overtime these forums have made me an asshole. ;D (TTT subforum) |:NxS:| Custom TTT Server: source.nxs-gaming.com:27016 |:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016 |:NxS:| Fretta: <COMING SOON>
|
|
|
nrich588
Poster
Posts: 253
WzG Owner
|
|
« Reply #5 on: December 18, 2011, 02:06:56 AM » |
|
sorry I confused you.
|
|
|
|
Bad King Urgrain
|
|
« Reply #6 on: December 18, 2011, 10:04:17 AM » |
|
Yep, they should go into /garrysmod/materials/.
|
|
|
|
nrich588
Poster
Posts: 253
WzG Owner
|
|
« Reply #7 on: December 18, 2011, 04:32:52 PM » |
|
For some reason they all aren't being downloaded, only my Jihad and Ak47, the others don't.
|
|
|
|
sniperduck
Poster
Posts: 178
|:NxS:| Staff! :D
|
|
« Reply #8 on: December 18, 2011, 09:01:39 PM » |
|
You need to have a resource.AddFile for the icons Example: --AutoDL the jihad shtuff :3
--snds resource.AddFile( "sound/siege/jihad.wav" ); resource.AddFile( "sound/siege/big_explosion.wav" ); resource.AddFile( "sound/yippiekay1.wav" ) ;
--icon resource.AddFile( "materials/vgui/ttt/icon_bw_jihadbomb12.vmt" );
--Das all.
|
Overtime these forums have made me an asshole. ;D (TTT subforum) |:NxS:| Custom TTT Server: source.nxs-gaming.com:27016 |:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016 |:NxS:| Fretta: <COMING SOON>
|
|
|
SovietX
Poster
Posts: 52
|
|
« Reply #9 on: December 20, 2011, 10:10:25 PM » |
|
Hey, Something easier to do is just add this code to lua/autorun/server. So any time you add new icons you won't have to do a new forcedownload. function AddDir(dir) // recursively adds everything in a directory to be downloaded by client local list = file.FindDir("../"..dir.."/*") for _, fdir in pairs(list) do if fdir != ".svn" then // don't spam people with useless .svn folders AddDir(dir.."/"..fdir) end end for k,v in pairs(file.Find("../"..dir.."/*")) do resource.AddFile(dir.."/"..v) end end AddDir("materials/vgui/ttt")
|
Be the best by any means necessary
|
|
|
Anonymous
Poster
Posts: 126
|
|
« Reply #10 on: December 20, 2011, 10:12:27 PM » |
|
Ty Soviet for that I'm sure it'll help somebody :) I didn't realise you were a lua person
|
I DO NOT HAVE A MOTHERFUCKING SERVER.
|
|
|
BipolarDiZ
Poster
Posts: 101
|:NxS:| Staff! :D
|
|
« Reply #11 on: December 21, 2011, 01:45:40 AM » |
|
That doesn't really make him a "lua person." The wiki has the same thing.
|
BipolarDiZ is bipolar. |:NxS:| Custom TTT Server: source.nxs-gaming.com:27015 |:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016 |:NxS:| Fretta: currently offline
|
|
|
Anonymous
Poster
Posts: 126
|
|
« Reply #12 on: December 21, 2011, 04:53:23 PM » |
|
Thats kinda why the sarcasm was there, nobody really comments their lines.
|
I DO NOT HAVE A MOTHERFUCKING SERVER.
|
|
|
sniperduck
Poster
Posts: 178
|:NxS:| Staff! :D
|
|
« Reply #13 on: December 21, 2011, 07:58:02 PM » |
|
Thats kinda why the sarcasm was there, nobody really comments their lines.
i do
|
Overtime these forums have made me an asshole. ;D (TTT subforum) |:NxS:| Custom TTT Server: source.nxs-gaming.com:27016 |:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016 |:NxS:| Fretta: <COMING SOON>
|
|
|
Anonymous
Poster
Posts: 126
|
|
« Reply #14 on: December 22, 2011, 11:48:04 AM » |
|
For what reason?
|
I DO NOT HAVE A MOTHERFUCKING SERVER.
|
|
|
nrich588
Poster
Posts: 253
WzG Owner
|
|
« Reply #15 on: December 22, 2011, 08:15:28 PM » |
|
It's a sign of a good coder, I code Java, Perl, HTML, PHP, and Javascript, Commenting is a life saver.
|
|
|
|
Handy_man
Poster
Posts: 308
SNG community admin
|
|
« Reply #16 on: December 22, 2011, 11:22:30 PM » |
|
Not sure if troll or terrible coder... you should always comment your code, its one of the first things that you should learn it helps you understand things later if you forget (better for larger scripts/ programs etc) just makes things quicker shows understanding and although not as important in personal lua scripts VERY useful. (helps others understand code any professional level requires this/ is standard.)
|
|
|
|
nrich588
Poster
Posts: 253
WzG Owner
|
|
« Reply #17 on: December 22, 2011, 11:54:31 PM » |
|
Handy, do you happen to know where I can locate the autorun file that shows steam ID's of players who leave?
|
|
|
|
Handy_man
Poster
Posts: 308
SNG community admin
|
|
« Reply #18 on: December 23, 2011, 01:48:45 AM » |
|
function PlayerDisconnect( ply ) PrintMessage( HUD_PRINTTALK, ply:Nick().. " has disconnected, his SteamID is: " ..ply:SteamID() ) end hook.Add( "PlayerDisconnected", "playerDisconnected", PlayerDisconnect )
Originally posted by someone else not my work although honestly its not exactly hard...
|
|
|
|
BipolarDiZ
Poster
Posts: 101
|:NxS:| Staff! :D
|
|
« Reply #19 on: December 23, 2011, 01:52:39 AM » |
|
Coder's should always comment there work. If you have enough work the old stuff isn't fresh in your mind. It is easier to come back to old code if it is commented. My opinion! :D
|
BipolarDiZ is bipolar. |:NxS:| Custom TTT Server: source.nxs-gaming.com:27015 |:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016 |:NxS:| Fretta: currently offline
|
|
|