AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] OM Prop Spawn - Updated 27/6/2011 (https://forums.alliedmods.net/showthread.php?t=119238)

-.-Owned Myself-.- 02-19-2010 05:10

[ANY] OM Prop Spawn - Updated 27/6/2011
 
4 Attachment(s)
MASSIVE UPDATE - Now Requires SMLIB
http://forums.alliedmods.net/showthread.php?p=1398699

Please Note that this is for compilation purposes only. You do not need this for running the plugin.


A little background on the plugin

This is my first public sourcemod plugin ever! Basically I wanted admins on my Zombiemod server to be able to spawn props. However each time I ran into a snag when attempting this with Eventscripts. I could only spawn Prop_Physics and Prop_Physics_Dynamic, which isn't very useful.

So I made this plugin! It allows Server Admins to spawn props which are defined in a text file (working example included). I wanted a safe way for admins to spawn props so I learnt a bit of Sourcepawn and here is the result!

Special Thanks

Model Menu - by pRED* - Without this, it would have taken me much longer to get my head around Keyvalues and Menus.

RP_Tools - I can't remember where I obtained this, but it's thanks to this that I know how to make props spawn in a nice way! It was nearly perfect for me, however not very user friendly.

-------------------------


Installation:

Extract om_propspawn.smx to addons/sourcemod/plugins
Extract om_public_props.txt to addons/sourcemod/configs

Configuration


Open om_public_props.txt and you'll find this:

Code:

"Props"
{
    "Vending Machine"
    {
            "model"            "models/props/cs_office/vending_machine.mdl"
            "height"        "50"
            "price"            "15"
    }
    "Sofa"
    {
            "model"            "models/props/cs_office/sofa.mdl"
            "price"            "5"
    }
    "Book Shelf"
    {
            "model"            "models/props/cs_office/bookshelf1.mdl"
    }
    "Dryer Box"
    {
            "model"            "models/props/cs_assault/dryer_box.mdl"
            "price"            "5"
    }
}

As you can see each prop can now have a "price" option. This sets the price for the prop if om_prop_public is set to 0. If there is no price option set in the file for a prop, it will be free to spawn.

If you wanted to change the height at which the individual prop spawned at:
Code:

"Props"
{
    "Vending Machine"
    {
            "model"            "models/props/cs_office/vending_machine.mdl"
            "height"            "50"
            "adminonly"      "1" //Means it's admin only if set to 1
    }
}

Commands

!props (or /props) - Brings up the menu for spawning props. - Requires Slay Flag

!credits (or /credits) - Shows you how many credits you have. (Public)

!om_admin_credits <name> <credits> - Allows you to modify player credits. Minus numbers can be used to remove credits.

!om_remove_props - Removes all props created by players

ConVars

om_prop_public <number> -0 means anyone can use this plugin. 1 means admins only

om_prop_teamonly <number> - 0 is no restrictions, 1 is Terrorist and 2 is CT. Default: 0

om_propspawn_version - Shows the plugin version

om_prop_credits <number> - The number of credits a player should get when they spawn. Default: 20

om_prop_removeondeath <number> - 1 means props are removed on death, 0 means they aren't

om_prop_addcreditsonkill <number> - 1 means credits are added when a player kills someone, 0 means they aren't.

om_prop_killcredits <number> - The number of credits added when a player kills someone. Default: 5
--------------------------------

And that's all I can think of putting down! Currently I have only tested this on CS:S but I don't see why it wouldn't work on any other source game (TF2 for instance), but i'm a newb at Sourcepawn so don't expect it to!

Currently tested and working on:
Counter-Strike:Source
Team Fortress 2

If anyone tests this on other games, please tell me if it loaded successfully and functioned properly and I will add the game to the list!

Attached should be:
om_propspawn.sp (thus the smx)
om_public_props.txt

Little Note:
All props spawned are prop_physics_override


Changelog:
Code:

V1.0.0: Initial Release

V1.0.1:
Added new "height" string to define custom spawn heights for each prop.

Example:
"Props"
{
    "Vending Machine"
    {
            "model"            "models/props/cs_office/vending_machine.mdl"
            "height"            "50"
    }
}

V2.0.0
Rewrite of plugin:

  • It now works on a system of credits.

  • Server Administrators can set whether or not normal players can spawn props (at a price).

  • 2 new ConVars added.

  • Team Only Setting added (Very useful for Zombiemod.) Spectators cannot spawn props anymore, no matter what value this ConVar is.

  • Replaced om_props.txt with om_public_props.txt

  • Uses ClientPrefs to manage credits.

V3.0.0
Another Rewrite of plugin:

  • Fixed a lot of stuff

  • Clientprefs no longer used

  • SMLib is now used

  • Fixed Admin Only commands (I hope)

  • Added ways of removing props

  • Props are removed on client disconnect

  • Added "adminonly" property for props (see example)

  • Added a way for credits to be added when a player kills someone


V3.0.2

  • Made the menu appear automatically after spawning a prop

  • Fixed Team restriction issues

  • Fixed props not being named properly

  • Fixed props not actually being deleted when using the command

  • Added debug mode in source code



anonpiss 02-19-2010 07:37

Re: [CS:S] OM Prop Spawn
 
If I spawn below the floor, will the prop bounce off the floor? Or stick to the floor like the ES SpawnProp script?

-.-Owned Myself-.- 02-19-2010 08:47

Re: [CS:S] OM Prop Spawn
 
Quote:

Originally Posted by anonpiss (Post 1093369)
If I spawn below the floor, will the prop bounce off the floor? Or stick to the floor like the ES SpawnProp script?

Wasn't expecting this question at all :O I tried it and if you go a certain distance below the floor, it will stick to the floor above (and sort of twitch). I'm not sure if there's a fix for this.

[EDIT]:
I've added a "height" string for props. This lets you define a custom spawn height. If no height is set, the default value of 100 is used.

Nuclear_Suspect 02-19-2010 12:08

Re: [CSS] OM Prop Spawn
 
Interresting, granted i currently use the 'Modelfun' plugin (By pRED i believe), but are your props destructable? (wooden boxes and the like)

-.-Owned Myself-.- 02-19-2010 19:24

Re: [CSS] OM Prop Spawn
 
Currently all props are indestructible. If people want certain props to be destructible I can try to add that feature.

Brotcrunsher 03-02-2010 03:56

Re: [CSS] OM Prop Spawn
 
Hey, very nice plugin, but it would be really really great if you could add the option to spawn prop_statics!

NukeMan 03-26-2010 07:21

Re: [CSS] OM Prop Spawn
 
-.-Owned Myself-.- Nice plugin, but I would like it public for all players, not admins only. It is possible?

-.-Owned Myself-.- 03-26-2010 12:51

Re: [CSS] OM Prop Spawn
 
To do this:
Open admin_overrides.cfg in addons/sourcemod/configs

Add:
Quote:

"om_propspawn" ""
And the command should then be accessible to all players. You may need to restart the server.

Make sure it isn't in the comments section!

{123} 04-23-2010 10:59

Re: [CSS] OM Prop Spawn
 
hi guys!
-.-Owned Myself-.- you may add cost to props?

-.-Owned Myself-.- 04-25-2010 16:12

Re: [CSS] OM Prop Spawn - Updated 25/4/2010
 
Hi guys, I've updated the plugin!

I've done a rewrite of it (from scratch with some copy and paste).

You can now set whether or not this will be public (set it in a cfg file.)

It also includes a credits system which uses clientprefs. Player credits are updated every time players are spawned.

Hopefully this enhances the gameplay experience for those who want to use this plugin.


All times are GMT -4. The time now is 18:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.