Garry's Mod 9 Icon GMod 9 Tutorial

How to add SWEPs

Attention Gamer! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Loyen points.
  • Post: Give Loyen your thoughts on this Tutorial.
  • Vote: Help Loyen win the Monthly Awards.
  • Rate: Give this Tutorial a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Tutorial.
  • Watch: Get notified when this Tutorial is updated.
Mascot

Sound fun?

Become a Bananite

Already a Bananite? Login

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

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

Posts

  • 7y
    Adam. avatar
    Adam. Offline
    Member Joined 7y
    wheres the qc file?
    The future is gone..for now. avatar
    Mantra
    The future is gone..for now.
  • 8y
    How make to an weapon Infinite Ammo?
    Whats about his Power level?
  • 9y
    Alfa1337 avatar
    Alfa1337 Offline
    Member Joined 10y
    6,571 points Ranked 655th
    13 medals 1 legendary 2 rare
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Submitted 50 Skins Medal icon
    • Reached 1,000 Points Medal icon
    • Reached 2,500 Points Medal icon
    • 1 post awarded Exemplary Feedback Medal icon
    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
     avatar
    Mantra
  • 9y
    Alfa1337 avatar
    Alfa1337 Offline
    Member Joined 10y
    6,571 points Ranked 655th
    13 medals 1 legendary 2 rare
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Submitted 50 Skins Medal icon
    • Reached 1,000 Points Medal icon
    • Reached 2,500 Points Medal icon
    • 1 post awarded Exemplary Feedback Medal icon
    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.
     avatar
    Mantra
  • 9y
    I am A Salad avatar
    Member Joined 9y
    186 points Ranked 18004th
    But this would change my default skin too wouldnt it? how to hex the skin?
    My mom said I'm cool...
  • 9y
    Beastly avatar
    Beastly Offline
    Member Joined 9y
    This is how to MAKE sweps
    we want to know how to ADD them
    Bananite
  • 10y
    cheesylard avatar
    cheesylard Offline
    Member Joined 10y
    138 points Ranked 22059th
    Pretty good

    4/10

    HIIII
  • 10y
    Xblah avatar
    Xblah Offline
    Member Joined 11y
    8,625 points Ranked 497th
    14 medals 1 legendary 3 rare
    • 10 years a member Medal icon
    • 2nd Place - Kepler-22b Mapping Contest Medal icon
    • 6 years a member Medal icon
    • Submitted 20 Maps Medal icon
    • Reached 1,000 Points Medal icon
    • Reached 2,500 Points Medal icon
    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.
    http://xblah.cjb.net avatar
    Mantra
    http://xblah.cjb.net
  • 10y
    TheSheepness avatar
    Member Joined 11y
    7,206 points Ranked 594th
    I don't either. so I just make one? and btw. how do you make your gun a .lua file? :S
    mmm pimpalicious avatar
    Mantra
    mmm pimpalicious
  • 10y
    emonoob666 avatar
    emonoob666 Offline
    Member Joined 10y
    I dont have a counter-strike folder under weapons on lua
    Bananite

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Key Authors
loyen_
Unknown

Submitter

Loyen avatar
Loyen Offline
Member Joined 11y
1,836 points Ranked 2516th
9 medals 1 legendary 1 rare
  • 10 years a member Medal icon
  • 6 years a member Medal icon
  • Reached 1,000 Points Medal icon
  • 1 post awarded Exemplary Feedback Medal icon
  • One month a member Medal icon
  • 6 months a member Medal icon

Loyen
Creator
Send a Private Message to the submitter

Category

Details

Difficulty Level
Intermediate Difficulty

Attributes

Miscellaneous
Genre
Other/Misc

Stats

Posts
16
Views
24,391
Date Added
10y
Date Modified
5y

Rating

4/10 by 1 rater

More Tutorials from Loyen

WiPs by Loyen