Welcome, Guest. Please login or register.
Did you miss your activation email?
September 22, 2014, 04:14:02 pm
Home Help Login Register
News: Zombie Master 2

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: VGUI Issues. « previous next »
Pages: [1] 2
Author Topic: VGUI Issues.  (Read 2318 times)
nrich588
Poster

Posts: 289

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:

Code:
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: 552



« 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: 289

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: 289

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: 325


|: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.

|:NxS:| Custom TTT Server: source.nxs-gaming.com:27015
|:NxS:| Fretta: source.nxs-gaming.com:27017
|:Nxs:| Rotation: source.nxs-gaming.com:27018
nrich588
Poster

Posts: 289

WzG Owner


« Reply #5 on: December 18, 2011, 02:06:56 am »

sorry I confused you.
Bad King Urgrain
Administrator
*****
Posts: 12744



« Reply #6 on: December 18, 2011, 10:04:17 am »

Yep, they should go into /garrysmod/materials/.
nrich588
Poster

Posts: 289

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: 325


|:NxS:| Staff! :D


« Reply #8 on: December 18, 2011, 09:01:39 pm »

You need to have a resource.AddFile for the icons

Example:

Code:
--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.

|:NxS:| Custom TTT Server: source.nxs-gaming.com:27015
|:NxS:| Fretta: source.nxs-gaming.com:27017
|:Nxs:| Rotation: source.nxs-gaming.com:27018
SovietX
Poster

Posts: 76



« 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.

Code:
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: 193


« Reply #10 on: December 20, 2011, 10:12:27 pm »

Ty Soviet for that I'm sure it'll help somebody smile I didn't realise you were a lua person

BipolarDiZ
Poster

Posts: 119


|: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
Anonymous
Poster

Posts: 193


« Reply #12 on: December 21, 2011, 04:53:23 pm »

Thats kinda why the sarcasm was there, nobody really comments their lines.

sniperduck
Poster

Posts: 325


|: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

|:NxS:| Custom TTT Server: source.nxs-gaming.com:27015
|:NxS:| Fretta: source.nxs-gaming.com:27017
|:Nxs:| Rotation: source.nxs-gaming.com:27018
Anonymous
Poster

Posts: 193


« Reply #14 on: December 22, 2011, 11:48:04 am »

For what reason?

nrich588
Poster

Posts: 289

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: 570


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.)

SNGaming.org | Thehiddennation.com
nrich588
Poster

Posts: 289

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: 570


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...

SNGaming.org | Thehiddennation.com
BipolarDiZ
Poster

Posts: 119


|: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! Grin

BipolarDiZ is bipolar.
|:NxS:| Custom TTT Server: source.nxs-gaming.com:27015
Pages: [1] 2  
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: VGUI Issues. « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines
Page created in 0.048 seconds with 19 queries.