i want to know how to make an addon for garrysmod.org, but everything in http://wiki.garrysmod.com/?title=Basic_Lua says its simple, but im finding it hard to undersatand (impossible) so can anyone tell me a super easy way for lua scripting, i don even properly know what it is yet! lol! were do i start, thnx!
Look in the LUA section, and learn from other addons.
That’s really all the help we can give. Just look at other people’s code and follow the wiki. Start with simple sweps and go from there.
As an after-activity, after you make one, it would be very helpful if you made an info.txt for your addons.
I know something VERY SIMPLE!
Try making BETA playermodels:
- Download a playermodel
- open the lua
- replace models ex: models/kleiner.mdl etc
- replace playermodel name ex: Kleiner
- give the person credit fo script
EDIT: This is the code, change NAME into what you want name to be and models/model.mdl into the model you want to use.
if ( SERVER ) then
player_manager.AddValidModel( “NAME”, “models/model.mdl” );
list.Set( “PlayerOptionsModel”, “NAME”, “models/model.mdl” );
Remember to have the same name and model on both places…
Also, you can add more than one player model by writing the same code under.
Shakur is right, use his very basic players to make your own basic addon.
He is right, but the code only needs to be:
[lua]player_manager.AddValidModel( “NAME”, “models/model.mdl” );
list.Set( “PlayerOptionsModel”, “NAME”, “models/model.mdl” );[/lua].
I guess I should pop in and ask, is there a certain file name that you have to save the .lua files as? I’ve seen them have names like shared.lua, init.lua, and even cl_init.lua.
Depends on the usage. If they are just NPCs, then you could call them something like “garryfoxnpcs.lua”, but they can’t be called “GarryFox’s NPCs.lua”. Don’t know why. It just doesn’t let the file work. The files you mention are used for weapons and entities. Everything else kinda follows the NPC naming route.
Okay, thanks… I just had a random idea of making a whole bunch of Prop Playermodels… I would name the Addon folder Prop Playermodels and put an info.txt inside, then a folder called lua, then a folder called autorun, and put my lua files in there?
Also, how do I get the Winzip to use a file path that I specify? Sorry for the overload of questions… :S
Yes, that is correct, also you can use _ in the lua name, like “garryfox’s_playermodels.lua”