How to add SWEPs

In this tutorial you will learn how to add new SWEPs. It's pretty hard in the beginning, but it will get easier with time.

  1. Start of with open your Gmod9 Folder (usually it will be in C:\Program\Steam\steamapps\SourceMods or somethin' like that)

2. Go to folder "lua/weapons/counter-strike" (if you want to add one of your hacks or favourite Css weapon as a new SWEP so you won't overwrite the old model).

3. Copy the lua-file for the weapon that the model is for and go out from the "counter-strike" folder and make a new folder (named to whatever you want) and paste the lua-file in there. Picture 1

Now the folder name will be the name of the category the weapon is in gmod9 and the *lua-files name (in this case "MP5Navy.lua) will be the name of the weapon in the category. Rename it if you want it to have another name. I renamed mine to "MP5Tactical.lua" (.lua will not be seen in gmod9).

  1. Now, open the lua in notepad (or other text editor) and look after following lines (the files below is just in this case, it can be in other cases "M4a1" or somethin') Picture 2
function getViewModel( ) return "models/weapons/v_smg_mp5.mdl"; end function getWorldModel( ) return "models/weapons/w_smg_mp5.mdl"; end

----This is the model files that gmod will load when you press the weapon SWEP button in-game. In my case I add "Tactical" after mp5.----

function getClassName() return "MP5 Navy"; end

-----This will be the class name----

function getPrintName() return "MP5 Navy"; end

----This will be the Printname----

5. Now to the weapon model. Open the weapons qc-file. Name the $modelname "weapons\v_smg_mp5.mdl" To the weapon model that the lua will load. In this case I just add "tactical" after mp5. Picture 3*

6. Then compile the weapon. (if you use GuistudioMDL compile to one of the games (like Css) and then go to cstrike/models/weapons folder cut out your weapon files and paste it in gmod9/models/weapons. copy the weapons materials to the right place in gmod (you only have to paste the materials folder in gmod9 folder)

Now you're ready to rumble!

Hope this was a easy read for being a first time. :)

//Loyen

Oh noes! You're not a Member!

Want access to cool stuff? As a member you can:

  • Post. Give the submitter your thoughts on this Tutorial.
  • Say Thanks. Show your appreciation by sending the submitter points.
  • Stamp Posts. Let other posters know what you think of their posts.
  • Rate. Give this Tutorial a rating out of 10.
  • Flag. Alert moderators and warn members of a problem with this Tutorial.
  • Vote. Vote the submitter for the Monthly Awards.
  • Subscribe. Get notified when this submitter submits again.

Interested? Register or Login

Comments

  • Adam.'s Levels
    • P3: Peasant
      Points: 7,916
    • A4: Graduate
      Account Age: 4 years
    Posted 4 years ago

    wheres the qc file?

    User Title
    The future is gone..for now.
  • TheToastOfFear's Levels
    • A5: Veteran
      Account Age: 5 years
    Posted 5 years ago

    How make to an weapon Infinite Ammo?

    Whats about his Power level?
  • Zube1337's Levels
    • P2: Drudge
      Points: 5,936
    • E1: Helper
      EF: 3
    • A6: Elder
      Account Age: 7 years
    Posted 6 years ago
    Posted by Loyen_
    Posted by Zube1337 Yeah it really works but middle of playing it,BSOD came out.I recheck the lua and the model like you said but there is nothing wrong with it.
    That's windows fault, not mine..

    Yes but still your fault

    User Title
    I love Windows Vista
  • Zube1337's Levels
    • P2: Drudge
      Points: 5,936
    • E1: Helper
      EF: 3
    • A6: Elder
      Account Age: 7 years
    Posted 6 years ago

    Yeah it really works but middle of playing it,BSOD came out.I recheck the lua and the model like you said but there is nothing wrong with it.

    User Title
    I love Windows Vista
  • I am A Salad's Levels
    • P1: Beggar
      Points: 186
    • A6: Elder
      Account Age: 6 years
    Posted 6 years ago

    But this would change my default skin too wouldnt it? how to hex the skin?

    My mom said I'm cool...
  • Beastly's Levels
    • A6: Elder
      Account Age: 6 years
    Posted 6 years ago

    This is how to MAKE sweps we want to know how to ADD them

    Bananite
  • cheesylard's Levels
    • P1: Beggar
      Points: 138
    • A6: Elder
      Account Age: 7 years
    Posted 6 years ago

    Pretty good

    HIIII
  • Xblah's Levels
    • P3: Peasant
      Points: 8,013
    • A6: Elder
      Account Age: 7 years
    Posted 6 years ago
    Posted by Loyen_ I can't make lua files, but I think the lua just telling you the name of the weapon, where the model is, what it can do, how much ammo it has.

    exactly.

    User Title
    http://xblah.cjb.net
  • TheSheepness's Levels
    • P2: Drudge
      Points: 7,168
    • E1: Helper
      EF: 1
    • A6: Elder
      Account Age: 8 years
    Posted 7 years ago

    I don't either. so I just make one? and btw. how do you make your gun a .lua file? :S

    User Title
    mmm pimpalicious
  • emonoob666's Levels
    • A6: Elder
      Account Age: 7 years
    Posted 7 years ago

    I dont have a counter-strike folder under weapons on lua

    Bananite

Credits

Submitter
Loyen's Levels
  • P2: Drudge
    Points: 1,715
  • E1: Helper
    EF: 3
  • A6: Elder
    Account Age: 8 years
Loyen (Creator/Co-creator)
Key Authors
loyen_
Unknown

Rating

4.0/10
Based off 1 rating(s)

Additional Info

Genre
Other/Misc
Difficulty Level
Intermediate

Stats

Post Count
16
ViewCount
21,507
Date Added
7 years ago
Date Modified
2 years ago

Share

Embed Code
Code to use:

More embeddable images

Bookmark and Share