• "Installing" Playermodels for Server
    14 replies, posted
Hey guys, I have a friend who just got their own garry's mod server, and since they know practically nothing about computers I am setting it up for them. I have never run a gmod server before, but I figure it out with a shitton of googling. Anyways, to my question: Are playermodels ALWAYS a pain in the ass? My current way of getting them on the server is: 1. add them all to a workshop collection 2. download the collection 3. convert/extract them with gmad extractor thingy 4. sort through the files that are extracted, manually switch between folders and uploading them to FTP 5. make a new lua file to get them into my pointshop This means each skin takes about 5 minutes. Is this the fastest way to get them on my server, or is there a better way?
That is the best way if you're using FastDL. If you use WorkshopDL, you can skip the extraction.
what is this magical workshopdl, and where do I get it?
[url]http://wiki.garrysmod.com/page/resource/AddWorkshop[/url]
[QUOTE=roastchicken;45353507]what is this magical workshopdl, and where do I get it?[/QUOTE] I wouldn't suggest using the workshopdl. It takes along time for people to join [QUOTE]1.they are separate workshop items 2.it has to download, and extract each item.[/QUOTE]
The nice thing about workshop is that you can have your server automatically download all addons in a collection and verify they're up to data on server start: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/setting_up_a_server_with_steamcmd.lua.html[/url] Get an api key for your server: [url]http://steamcommunity.com/dev/apikey[/url] And set up a collection, then just take the number id from the url and plop it in your launch options. If you aren't putting maps into the content pack, and ALL content is needed to play, you can EASILY automate the client-download segment by doing: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/content_and_resources/download_workshop_content.lua.html[/url] Just a loop on engine.GetAddons( ) - serverside. The compare list is optional ( if you want to verify the client has all of them when they join, send them the list and run it through engine.GetAddons( ) on the client. Remove entries as they appear from the table and if you're left with any, you don't have all of them. This is as bare-bones as it gets. The example with the .maps, etc is how you could extend it. If you are going to be having different maps, you could download them all and put them on server without putting them in the online workshop collection, then if game.GetMap( ) is blah then load x addons... OR you can automate it by using the suggestions from the tut. To list all files in the addon, you can recurse through the addon by doing local _files, _folders = file.Find( "*", v.title ); from the same addons thing below - Put it in a function and for each folder call the function on itself for that folder for that addon, then for each file check the type, make a table of contents if you like, or whatever: [code]// // Add all Server addons to client-download-list - Josh 'Acecool' Moser // hook.Add( "Initialize", "CompareAddons:BuildList", function( ) // Go through all addons for k, v in pairs( engine.GetAddons( ) ) do // Some addons don't have proper .wsids, parse the name if that occurs. local _file = v.wsid && v.wsid || string.gsub( tostring( v.file ), "%D", "" ); // Make the client download it. resource.AddWorkshop( _file ); end end );[/code] If you need more help, feel free to ask. Example of gathering information: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/file_structure/addon_info_CLIENT.txt[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/file_structure/addon_info_SERVER.txt[/url] Output is formatted like this for each addon just for sake of output; the table of contents is easily accessed by info.maps, info.models, etc... All files can be isolated to a certain list if need be. <Title> ==== <Table of contents, quick overview of data> ==== <files> FastDL is slow because it sets up a new connection for each file it downloads, closes file connection, repeats. Even for 1 byte files it takes a few seconds just because of the connection process. Workshop downloads at MUCH faster speeds, and they do NOT need to be extracted to be used. In fact, if you manually extract the .GMA files, you'll slow down loading time. If you keep them in .gma form, loading time decreases exponentially... I did an experiment, I extracted all 40ish addons on my server, it took over 5 minutes to connect and load in. Each auto-refresh took 30-60 seconds. I removed extracted content and just used .gma, autorefresh is down to 1-5 seconds, and 30 seconds to connect and load in ( tops ). And I run one of the most memory hogging maps: rp_evocity_v33x plus 300 vehicles, and a ton of other addons.
...but I AM using addresource... I STILL have to extract to add it to my pointshop. I'm confused.
[QUOTE=Acecool;45353855]-newfangled code-[/QUOTE] So, I assumed this is better than just doing a resource.lua, and handles it a bit smarter too? Because I hate it when Gmod downloads the addons and extracts them, even if you already are subscribed to them. And question [code] resource.AddWorkshop( _file )[/code] Do we put a workshop number in () or leave as is?
[QUOTE=roastchicken;45354058]...but I AM using addresource... I STILL have to extract to add it to my pointshop. I'm confused.[/QUOTE] You will always need to extract to add to your pointshop, that's just for clients to download the files
[QUOTE=Scarface3353;45354501]You will always need to extract to add to your pointshop, that's just for clients to download the files[/QUOTE] Actually, you only need to extract so you know where the model location is. After that you can just delete the addon folder.
You don't need to extract to know the model location; if you look at the two txt files, you'll see that browsing gma files via Lua is possible, and simple. I have many mods on my server; I have only extracted M9K for the sole reason of removing hundreds of Lua files as I use my own base. I use M9K for the models, not the Lua or effects or whatever. The only reason to extract is if you don't want to make a Lua script to print out the files/folders of the addon, or if you want to prevent Lua files from loading. Other than that, keep them in GMA form. For pointshop, you'll need to make the item files. For resource.AddWorkshop, use the id from the URL. Or, if it downloads to your server as ds_12345.gma, use "12345".... If you need to see if malicious Lua code is being ran in a .GMA, you can open the GMA file in notepad++.. All Lua is plain-text and easily identifiable, not only that but you can search for things such as numbers strung together, RunString, concommand.Add, CompileString, _G["RunString"] or _G[ string.char( ) ], etc... I'm going to be putting together a few tutorials on spotting backdoors in Lua files in the near future with real-life examples ( For the sake of preventing backdoors from spreading, I may not include the entire code, but segments which are useless by themselves to prevent copy/pasters ). Additionally I'll be considering releasing a simple utility to track certain aspects of a game-mode / log it in several locations. Daily Server, Rcon, Per player, etc... There is a useful function people can use for now if they are IsAdmin( ); lua_find x where x is a search term. It'll output code into the console that matches the search so if you search for superadmin, or string.char superadmin or whatever else, and it files it, it'll tell you where it is.
I never knew you could open up a .gma by just opening it in Notepad++, thanks [code]GMAD´  ߤ3S Borderlands - Crimson Lance Playermodel A Crimson Lance Playermodel from Borderlands Features: Playercolor Support Firstperson Arms Borderlands-esque lightwarp Black outline for both Firstperson Arms and Playermodel! Tags: Crimson Lance Borderlands Gearbox author   lua/autorun/crimsonlance_playermodel_cvp.lua ^ ‚Ö"Í materials/models/player/lordvipes/bl_clance/blshade.vtf @ ¬gÉ materials/models/player/lordvipes/bl_clance/crimsonlance_body.vtf @VU kc materials/models/player/lordvipes/bl_clance/crimsonlance_body_bump.vtf Ð  â" materials/models/player/lordvipes/bl_clance/crimsonlance_body_glow.vtf Ð  ¡ÿ materials/models/player/lordvipes/bl_clance/crimsonlance_head.vtf @V ²üP materials/models/player/lordvipes/bl_clance/crimsonlance_head_bump.vtf Ð  Ô-° materials/models/player/lordvipes/bl_clance/crimsonlance_head_glow.vtf Ð  Q_D¯ materials/models/player/lordvipes/bl_clance/crimsonlance_id1_d.vmt ¨ _ materials/models/player/lordvipes/bl_clance/crimsonlance_id3_d.vmt © •ºK“ materials/models/player/lordvipes/bl_clance/outline.vmt U “/xe materials/models/player/lordvipes/bl_clance/outline.vtf ˆ â.¿î materials/models/player/lordvipes/bl_clance/arms/crimsonlance_id1_d.vmt ¨ _ materials/models/player/lordvipes/bl_clance/arms/outline.vmt W Tå models/player/lordvipes/bl_clance/crimsonlanceplayer.dx80.vtx А þ â` models/player/lordvipes/bl_clance/crimsonlanceplayer.dx90.vtx ‡ „p}/ models/player/lordvipes/bl_clance/crimsonlanceplayer.mdl ¸K 뱟 models/player/lordvipes/bl_clance/crimsonlanceplayer.phy Ùk ƒ|<• models/player/lordvipes/bl_clance/crimsonlanceplayer.sw.vtx œƒ d…Ûc models/player/lordvipes/bl_clance/crimsonlanceplayer.vvd € 8 models/player/lordvipes/bl_clance/crimsonlanceplayer.xbox.vtx æˆ «GE• models/player/lordvipes/bl_clance/arms/crimsonlanceamrs.dx80.vtx &¯ ÿ»,â models/player/lordvipes/bl_clance/arms/crimsonlanceamrs.dx90.vtx ʪ •pÑL models/player/lordvipes/bl_clance/arms/crimsonlanceamrs.mdl •9 l§í models/player/lordvipes/bl_clance/arms/crimsonlanceamrs.sw.vtx Z¨ š°ûG models/player/lordvipes/bl_clance/arms/crimsonlanceamrs.vvd @Q °æÄ models/player/lordvipes/bl_clance/arms/crimsonlanceamrs.xbox.vtx ʪ y®¸Ì player_manager.AddValidModel( "Crimson Lance", "models/player/lordvipes/bl_clance/crimsonlanceplayer.mdl" ) player_manager.AddValidHands( "Crimson Lance", "models/player/lordvipes/bl_clance/Arms/crimsonlanceamrs.mdl", 0, "00000000" ) list.Set( "PlayerOptionsModel", "Crimson Lance", "models/player/lordvipes/bl_clance/crimsonlanceplayer.mdl" )VTF[/code] very useful, thanks.
so i never ever need to extract. cool! thanks for that tip Acecool
wait so for the item file, should I have ITEM.Model set to the model file listed in the gma text, or the gma file itself?
[QUOTE=roastchicken;45393311]wait so for the item file, should I have ITEM.Model set to the model file listed in the gma text, or the gma file itself?[/QUOTE] Model inside.
Sorry, you need to Log In to post a reply to this thread.