Lua Help!

When I Try To Make A Gmod SWEP,The Model Comes Out As ERROR.
I Need Help!

(User was banned for this post ("Undescriptive thread title; wrong section" - mahalis))

Can you post the code to your SWEP? I can tell you right now, you’re either missing the model, or don’t own the game to which the content belongs to.

Can I Just Send You My Swep Instead?

that is a very unspecific thread title
and a poor description of your problem

I think you should read this:

the code of your swep IS your swep

HERE Is What It Says On My Lua File:

if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			= "pistol"


if ( CLIENT ) then

SWEP.Author				= "purelyawsome"
SWEP.Contact			= ""
SWEP.Purpose			= "Pwn Anything In Ur sights"
SWEP.Instructions		= "Figure It Out UrSelf."
SWEP.PrintName			= "Random Gun"
SWEP.Slot				= 2
SWEP.SlotPos			= 0
SWEP.IconLetter			= "c"

SWEP.ViewModelFlip		= true



SWEP.Base = “weapon_cs_base”

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_models/v_pist_usp.mdl”
SWEP.WorldModel = “models/weapons/w_models/w_pist_usp.mdl”

SWEP.Weight = 4
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true

SWEP.Primary.Sound = Sound( “gauss.wav” )
SWEP.Primary.Recoil = 0
SWEP.Primary.Damage = 100
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.01
SWEP.Primary.ClipSize = 800
SWEP.Primary.Delay = 0.15
SWEP.Primary.DefaultClip = 800
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “pistol”

SWEP.IronSightsPos = Vector(-5.15,-3,2.37)
SWEP.IronSightsAng = Vector(-.4,0,0)


What Do You Mean “don’t own the game to which the content belongs to.”?

I’m Sorry Man I Cannot Help You I Am Not Good At Scripting.

(User was banned for this post ("Why reply if you can't help?" - Benji))


When it sais…

SWEP.ViewModel = “models/weapons/v_models/v_pist_usp.mdl”
SWEP.WorldModel = “models/weapons/w_models/w_pist_usp.mdl”

Delete the “models”. So…

SWEP.ViewModel = “weapons/v_models/v_pist_usp.mdl”
SWEP.WorldModel = “weapons/w_models/w_pist_usp.mdl”

It Still Shows Error. :frowning:


Does Anyone Know How To Post Pictures?
I Can’t Figure It Out.

use [ img ] [ /img ] (without spaces)

And when you’re going to post any considerable length of code ALWAYS use [noparse][lua] [/lua][/noparse] tags. So that we can see your indentation.

I want you to type this in console exactly as it is.

lua_run_cl print( file.Exists( "../models/weapons/v_models/v_pist_usp.mdl" ) )

Tell me what it prints (should be true/false).

It Said “false”.

Then that model that your telling it to be set to is non existent.

How To I Fix It?

Use a model that exists. Find one you like and use it.

That is because you do not own Counter Strike: Source. So you need to use a different model.

and you mean [noparse]

[/noparse] ( = I don’t know why anyone uses lua tags.

another useful tip: Don’t Capitalize Every Word.

(User was banned for this post ("This isn't helpful" - mahalis))

It doesn’t let me insert tags but they are used for simplicity.

Lua tags do not show up in Internet Explorer.

To insert tags you have to use [noparse][noparse][/noparse][/noparse] soo like [noparse][noparse]

or [lua][/lua][/noparse][/noparse]

I Didn’t say tags were bad I just mean not every one can see the code in lua tags because it doesn’t work for Internet Explorer. That why I said they should use the code tags instead.