Raised This Month: $32 Target: $400
 8% 

[L4D] Item Buy System


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author
(-DR-)GrammerNatzi
Senior Member
Join Date: Jun 2009
Plugin ID:
955
Plugin Version:
1.278
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    10 
    Plugin Description:
    This plug-in allows players to get points through various ways on both the infected and the survivors. They can use these points to purchase things that will help them, like incendiary ammo, ammo refills, health, items, weapons, infected, mobs, and more.
    Old 06-24-2009 , 22:20   [L4D] Item Buy System
    Reply With Quote #1

    This is my first plugin that I have made for Sourcemod. I decided that it would be nice to see something simple like this, and, seeing as I don't see any other addons that do this kind of thing (I may be wrong), I decided to make it my first project.

    The point of this plugin is to allow survivors (and infected) to be rewarded for teamwork. They can also be rewarded for killing special infected and a certain number of regular infected, but they will not get nearly as many points for doing so. They will get much more points for helping someone up or healing someone than killing a hunter. They can then use these points to buy rewards. I also added an admin gifting system that I made in my spare time, which probably won't be as useful, but is still a nice touch.

    Any constructive criticism is appreciated.

    Console Commands (add a ! or / and subtract sm_ for chat):

    • points - Shows the current number of points
    • itempointshelp - Shows the commands for points and provides a basic introduction of them to the client.
    • usepoints - The buy menu. Number of points needed to buy an item are displayed next to the item. Has two pages and contains all weapons, pipe-bombs and molotovs, refill, and heal.
    • repeatbuy - Purchases what you purchased previously.
    • refill - Refills an admin's ammo.
    • heal - Refills an admin's health (can revive).
    • fakegod - Makes an admin invincible.
    • sm_clientgive - Gives a client an item. Syntax - sm_clientgive <client(s)> [item number]. Numbers: 0 - Shotgun, 1 - SMG, 2 - Rifle, 3 - Hunting Rifle, 4 - Auto-shotty, 5 - Pipe Bomb, 6 - Molotov, 7 - Pistol, 8 - Pills, 9 - Medkit, 10 - Ammo, 11 - Health.
    • sm_clientgivemenu - Does the same as above, but with a menu. The above should only be used for binds.
    • sm_clientgivepoints - Gives clients (or yourself) points.
    • sm_clientsetpoints - Sets the points of a client (or you).
    Cvars (I only put working ones here. If it isn't shown, it doesn't work. Also, if the cvar has to do with a purchasable's cost, making the number -1 will disable the purchasable.):
    • points_on - Turns the point system on or off. (Default: 1)
    • points_amount_infected - How many points you get for killing a certain number of regular infected (Default: 2)
    • points_amount_specialinfected - How many points you get for killing a special infected. (Default: 1)
    • points_amount_heal - How many points you get for healing a teammate. (Default: 5)
    • points_amount_revive - How many points you get for reviving a teammate. (Default: 3)
    • points_amount_witch - How many points you get for killing a witch. (Default: 5)
    • points_amount_witch_instakill - How many additional points you get for killing a witch instantly. (Default: 3)
    • points_amount_tank - How many additional points you get for killing a tank. (Default: 2)
    • points_amount_infectednum - How many killed infected it takes to earn points. Headshot and minigun kills can be used to rank up extra kills. (Default: 25)
    • points_amount_extra_headshotkills - How many extra kills survivors are awarded for scoring headshots. 0 = None. (Default: 1)
    • points_amount_extra_minigunkills - How many extra kills survivors are awarded for scoring minigun kills. 0 = None. (Default: 1)
    • points_amount_infected_hurt - How many points infected get for hurting survivors a number of times. (Default: 2)
    • points_amount_infected_incapacitation - How many points infected get for incapacitating survivors. (Default: 5)
    • points_amount_infected_pull - How many points you get [as a smoker] for pulling a survivor. (Default: 1)
    • points_amount_infected_pounce - How many points you get [as a hunter] for pouncing a survivor. (Default: 1)
    • points_amount_infected_vomit - How many points you get [as a boomer] for vomiting/exploding on a survivor. (Default: 1) This can be racked up by vomiting/exploding on multiple survivors.
    • points_advertising - Turns on or off advertising. 1 = Short Advertisement, 2 = Normal Advertisement, and 0 = Nothing. (Default: 0)
    • points_price_<purchasable> - Adjusts the price of the purchasable.
    • points_infected_price_<purchasable> - Adjusts the price of an infected purchasable.
    • points_special_price_<purchasable> - Adjusts the price of special purchasables.
    • points_limit_<tanks/witches> - Sets the round limit for tanks and witches that can be bought using points.
    • points_advertising_remind - Tell clients how to get their broken number binds to work? (Default: 0)
    • points_reset_round - Do we want to reset points on round end? Resets points every two rounds in versus. (Default: 1)
    • points_advertising_ticks - How much time till the optional advertising is displayed? (Default: 80)
    • points_advertising_remind_ticks - How much time till the optional gamepad reminder is displayed? (Default: 60)
    • points_special_burn_time - How long do you get incendiary ammo for in seconds? (Default: 30)

    Future Additions:
    • Add more rewards.
    • Add more opportunities to get points.
    • Add more "power-ups".
    Servers running this plug-in:

    http://www.game-monitor.com/search.p...&type=variable

    Servers running the current version:

    http://www.game-monitor.com/search.p...ame=left4dead2

    Change Log:

    Version 1.278: Added a variable to set the amount of rounds until reset.

    Version 1.277: Fixed points_reset_round and made it reset every two rounds in versus. Also defaulted it to on. Was tired of all the servers with prices at about 5,000 for a shotgun, anyway.

    Version 1.276: Fixed infected getting SI and witch kill points. Also raised tankonfire array size a bit.

    Version 1.275: Made the PLAYERS variable control every number related to the amount of players and fixed up the code a bit.

    Version 1.274: Made the panic event five mobs instead.

    Version 1.273: Made the number that cancels the purchasable -1. Found out that the only reason it wouldn't do it was because of some stupid typo I made.

    Version 1.272: Added super incendiary ammo that can burn special infected for a higher price and made the points announcements shorter.

    Version 1.271: Got rid of points_reset.

    Version 1.27: Added incendiary ammo and changed the points menu. There is now a special menu that has things that are more like power-ups than items. Expect more to be added soon. There is only incendiary ammo right now. You can also change the time incendiary ammo lasts, too.

    Version 1.263: Fixed bug where optional advertising could not be turned off.

    Version 1.262: You can now change the amount of time till the optional advertisement/gamepad reminder comes up. A few bugs have been fixed, too.

    Version 1.261: Points can now be chosen to reset at round ends, map loads, or both.

    Version 1.26: Added the ability to spawn mobs and panic events, and added the repeatbuy command.

    Version 1.256: Boomer cost fixed.

    Version 1.255: Changed disabling cost.

    Version 1.254: You can now disable items by making their cost -1 or below. Infected can no longer spawn in safe areas. Also, there is now an option to remind players how to get their number keys working.

    Version 1.253: Tank and witch spawning bug fixed.

    Version 1.252: There is now a limit for the amount of tanks and witches that players can spawn per round.

    Version 1.251: Can't get points as infected by attacking your own teammates now.

    Version 1.25: The points menu has been revamped to be more flexible. Tank points are now fixed (no more mass points when a tank is burned), and you can now change the price of items. Also, the code is a little cleaner, but it's not like you'll care.

    Version 1.24: Fixed a big error that made the plug-in not work.

    Version 1.23: Added a set points command and fixed some bugs here and there.

    Version 1.22: Tank burning points working now, tank and witch price raised to make versus a tiny bit less of a survivor slaughter fest.

    Version 1.21: Fixed a few problems concerning points and removed end round point clearance for versus and survival.

    Version 1.2: Big changes here. Infected can now get their own points by pouncing, vomiting/exploding and pulling survivors plus more. They even get their own menu, which is opened using the same command. Admins can now give clients points, too. Also, tank burn points are in again.

    Version 1.156: Now compatible with Super Versus.

    Version 1.155: Commented out two cvars.

    Version 1.154: Plugin now auto-creates a config.

    Version 1.153: Commented out tank burning points, since it was very buggy.

    Version 1.152: Some typos in text fixed.

    Version 1.151: Points can also be earned by killing or burning the tank now (sadly, there is no way I have found so far as to finding out if a player hurt a tank). You can get a total of 4 points from a tank.

    Version 1.15: You can now get points by killing a witch and additional points for killing the witch instantly. Points are now named item points (although are often called points for short) to make them a bit more self-explanatory.

    Version 1.14:
    Advertising is now off by default. If you want to turn it on, there is now a cvar to do so.

    Version 1.13: Even more hotfixing. Turns out I made a typo on the heal item, so it wouldn't work. This is fixed now. Also, the number of points you have is now shown in the menu title.

    Version 1.12:
    Another hotfix. The default value of points you get for killing 25 infected has been raised by a point and some text has been changed.

    Version 1.11: Hotfix considering invalid point numbers.

    Version 1.1: Added convars for points, added convars to turn off points (sm_on_versus doesn't work yet), and also fixed some code here and there. You no longer get points for opening doors (it was buggy). I also made the repeating message a bit more informative about what the plug-in actually does; some people I was playing with thought it was some other version of HLStatsX and ended up leaving. Also, refill, heal, and fakegod are now admin only commands, but they can still be awarded to clients and refill and heal can still be used with the point system. The price of the Shotgun and the SMG were raised to 5 to prevent cheap refills.

    Version 1.0: None.

    Credits:

    Madcap, {7~11} TROLL - I used their code for the Tankbuster menu (Troll) and ledge release (Madcap) as a reference. I learned how to give items to clients and create menus from Madcap's code (in fact, some of it is in there, just heavily modified), and I learned how to tie events to functions from Troll's code.

    AlliedModders LLC - I used the slap code as a reference for the gift plugin.

    The SourceMod Community as a whole - Special thanks to Exvel (I used his method of god mode for the fakegod in this plugin) and base64 (I used his method of message announcing for the announcement of the plugin on the server every 80 seconds).
    Attached Files
    File Type: sp Get Plugin or Get Source (L4DPointsandGift.sp - 15355 views - 67.8 KB)

    Last edited by (-DR-)GrammerNatzi; 10-05-2009 at 19:22.
    (-DR-)GrammerNatzi is offline
     



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


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


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