Thread: Model Fun
View Single Post
Author Message
Arg!
Veteran Member
Join Date: Jul 2008
Location: Australia
Old 03-06-2009 , 05:37   Model Fun
Reply With Quote #1

Model Fun - By Arg!

Description:
Spawn 'things' in game in various ways. Go spectator and drop models on people. Spawn any in game model, anywhere as physics prop or static prop. Attach models to players heads. Attach particles to players, if supported by the game engine. Full admin menu support in server commands and player commands menus. Ability to save a list of common models and particles for use in admin menus (some HL2 models are loaded on first plugin load). Particles lists are set per game.

For TF2 Users:

Since Valve removed support for parenting entities in TF2 recently (as of May 2010) this plugin now has support for the Metamod:Source and Sourcemod extension library 'Attachables' by voogru. Please see the thread http://forums.alliedmods.net/showthread.php?t=126577 for more information about how to install this library and regain TF2 support for this plugin.
Note that you will not be able to see the model on yourself when using this method.

Notes:
  • In some games, dropping models on people does no damage (eg TF2) whilst in others dropping stuff causes damage (eg CS:S).
  • Some models cannot be spawned as physics props and will not drop when spawned.
  • Use the console command - listmodels - to get all models loaded currently for the map.
  • You can still spawn any accesible model from hl2 or the game mod but there will be a small lagout while its cached.
  • Native functions are provided to allow other plugins to access the hat command, the idea behind it is u can create a plugin with custom hat models to handle the download table. If you are a plugin developer, check the include file for native function information.
  • Only ever spawn .mdl files.
  • You can only spawn 1 model at a time.
  • Hats work on players who are in spectator, which can be good fun, but be warned whilst being hatted and spectating. Hats will obstruct the players view if big enough.
  • If you add models directly to the file 'data/modelfun.txt', do sm_refreshmodels to get them into the admin menu.
Commands:
  • sm_spawnphysics <modelpath> - spawn a model with physics properties.
  • sm_spawnmodel <modelpath> - spawn a static model (does not move)
  • sm_removemodel - removes last spawned model from the map.
  • sm_removemodels - removes all spawned models.
  • sm_hat <name or #userid> <modelname> - attaches a model to specified player(s) head.
  • sm_phat <name or #userid> <particlename> - attaches a model to specified player(s) head. ORANGE BOX OR GREATER ENGINE ONLY
  • sm_modellist - dump modelfun model list to console.
  • sm_particlelist - dump modelfun particle list to console.
  • sm_refreshmodels - reload modelfun model list from file 'data/modelfun.txt'
  • sm_refreshparticles - reload modelfun particle list from file 'data/modelfun.txt'
  • sm_addmodel <model name> <model file path> - Add a model to the modelfun model list (<model name> is a short name for the model which you choose)
  • sm_deletemodel - <model name> - Remove a model from the modelfun model list.
Cvars:
  • sm_maxitemspawns - maximum allowed models on the map at the same time. Defaults to 10.
Special Thanks to:
  • Spazman0 - This plugin is an extension of code written to attach hats to players heads which was 100% designed and written by Spazman0.
Thanks to:Some Example Models:

These models are available in all source games as they are in hl2 base, have a poke around in the hl2/models dir and your mod specific dir for more:
  • models/alyx.mdl - everyone loves alyx!
  • models/props_combine/combine_citadel001.mdl - This one spawns automatically adds itself to the skybox and its HUGE. Try spawning stuff in the skybox, makes it 16(?) times bigger.
  • models/dog.mdl - People who have not played hl2 will get confused at this.
  • models/gman.mdl - Suitcase man returns!
  • models/egypt/pillar/pillar_big.mdl (TF2 Only)- As of 20 March 2009 this model falls very slowly. For more fun spawn some in the skybox.
Example Plugins:
mf_rememberhats

This plugin utilizes natives exposed in modelfun to save a hat to a player against their steam ID in a file. This means they will always have this hat when they join a server.

Commands:
  • sm_permhat <name or #userid> <modelname> - sets a hat for player to recieve every time they join the server
  • sm_permhatoff <name or #userid> - removes persistent hat from player
Changelog:

10th September 2008 - 0.1
  • Initial Release
  • Compiled for Sourcemod 1.2.0
17th March 2009 - 0.2
  • Added example plugin mf_rememberhats
  • Compiled with Sourcemod 1.2.0
  • All commands now check ROOT admin flag
18th March 2009 - 0.3
  • Can now spawn mulitple entities
  • Added command sm_removemodels to remove all spawned entities
  • Added cvar sm_maxitemspawns to set maximum number of entities spawned
27th June 2009 - 0.4
  • Compiled with Sourcemod 1.2.1
  • Added ability to read model info from 'data/modelfun.txt' kv file (defaults created on plugin load).
  • Added admin menu to spawn physics model (server commands).
  • Added admin menu to spawn static model (server commands).
  • Added admin menu to remove all models (server commands).
  • Added admin menu to hat player (player commands).
  • Added command 'sm_modellist' to dump loaded model list to console.
  • Added command 'sm_refreshmodels' to reload model list from KV file.
  • Added command 'sm_addmodel' to add model to modelfun model list.
  • Added command 'sm_deletemodel' to remove model from modelfun model list.
4th August 2009 - 0.5
  • New command sm_phat <target> <particle_name> to attach particles to players (only supported in game which use info_particle_system, TF2 and L4d at time of writing)
  • Added player menu for sm_phat
  • Added list support for particles for TF2 and L4D
  • Added commands sm_particlelist and sm_refreshparticles to list and reload particle lists respectively
  • Fix for late loading admin menus
  • Remove all models (sm_removemodels) will now work correctly
29th August 2009 - 0.6
  • CS:S Hats should now display at a better height
  • Included more complete list of TF2 Particles in release zipfile
  • Compiled with Sourcemod 1.2.2
15th October 2009 - 0.7
  • Fix to allow sm_maxitemspawns to be changed on the the fly.
22nd May 2010 - 0.8
28th March 2011 - 0.9
  • Updated to most recent 'Attachables' include file.
Attached Files
File Type: zip modelfun_0.9.zip (57.1 KB, 3338 views)
File Type: zip modelfun_0.8.zip (57.1 KB, 741 views)
__________________

Last edited by Arg!; 03-28-2011 at 02:46. Reason: 0.9 release
Arg! is offline