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

[CS:S] Ammo From Dead


Post New Thread Reply   
 
Thread Tools Display Modes
Author
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Plugin ID:
2705
Plugin Version:
0.2.1.8
Plugin Category:
Fun Stuff
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    When players die, they drop the ammo from their weapons on the ground
    Old 12-13-2011 , 23:40   [CS:S] Ammo From Dead
    Reply With Quote #1

    This plugin changed scope on 12/31/11 - it is now Ammo From Dead instead of Ammo Pickup

    This plugin was a request - read about it here

    DESCRIPTION
    When a weapon is dropped as a result of a player's death, an ammo box will be dropped alongside the weapon. The weapon entity's extra ammo will be set to 0 and the ammo box will contain what the extra ammo was. If the weapon had 15 in the clip with 75 reserve, the ammo box will have 75 rounds.

    It will also record the weapon type (Rifle, Pistol, or Shotgun) and the ammo type. There are CVars (see below) where you can deem if a player can fill their ammo even if the ammo type is different. You can also set this plugin to abide by weapon ammo max so that players cannot pick up more than the default ammo max allowed.

    Explanation of allowing or disallowing picking up ammo of the same type if the weapon that dropped it was different - player1 dropped their MP5 rifle and a box of 9mm ammo was dropped from that weapon. If player2 has a glock (which is 9mm) and you have mixed ammo set to "allow" then player2 can pick up that 9mm ammo - if, on the other hand, you have mixed ammo set to "disallow" then player2 cannot pick up that ammo even though their glock uses the same ammo type.

    There are three models for the ammo boxes (all included with CS:S, so no need to have anything downloaded to your clients). A model for shotgun ammo, a model for pistol ammo, and a model for rifle ammo. There's also two sound files (also included with CS:S, no need for a download) that fires when players pick up the ammo (you define which one you want to use).
    Here are the three models:
    [img]http://img402.**************/img402/984/ammofromdead.png[/img]

    You can also set to only allow players to drop pistol ammo, or only drop rifle ammo, or be able to drop both. Also, you can set if bots drop ammo or not.

    Also, this plugin is Updater capable and a CVar is present (defaulted to off) so you can set whether this plugin gets auto-updated or not (if you have the Updater plugin).

    CVars


    REQUIREMENTS
    SourceMod 1.4.4+
    SDKHooks

    Optional
    Updater

    CREDITS and THANKS
    Bacardi for borrowed code from Healthkit from dead plugin

    GrO for the tremendous help in testing and suggesting tweaks. GrO was the initial requester and helped out a lot.

    Folks on IRC for putting up with my questions

    CHANGE LOG

    TO DO LIST
    mmm - suggest something :)

    INSTALLATION
    Copy the SMX file to your plugins folder. If you want to compile yourself, you'll need SDKHooks include and Updater include files. The web compiler will not compile the .sp, so you'll need to download the attached .smx.

    Also, you need to put the giveammo.txt in your gamedata folder.

    A config file will be created when you first launch this plugin - it will be in your cfg\sourcemod folder named plugin.ammo_from_dead.cfg

    UPGRADING?
    If upgrading to a new version that has new CVars, it's best to backup your old config file and delete it, then let the plugin create a new one for you, then edit that newly created one. This way, you get all of the available configs so you can set the way you want.

    SCREENSHOTS
    Attached Thumbnails
    Click image for larger version

Name:	ammofromdead.jpg
Views:	1764
Size:	31.6 KB
ID:	97595  
    Attached Files
    File Type: txt giveammo.txt (141 Bytes, 1190 views)
    File Type: smx ammo_from_dead.smx (16.9 KB, 1087 views)
    File Type: sp Get Plugin or Get Source (ammo_from_dead.sp - 1090 views - 35.4 KB)
    __________________
    View my Plugins | Donate

    Last edited by TnTSCS; 04-22-2013 at 00:29. Reason: Removed left over debug code
    TnTSCS is offline
    GrO
    Veteran Member
    Join Date: Jun 2010
    Location: Poland
    Old 12-14-2011 , 01:27   Re: [CS:S] Ammo Pickup
    Reply With Quote #2

    Great job, but I have few things on my mind:

    1) Is it possible to not override the default limit of overall ammo count? I've noticed that You can pick up ammo boxes all the time, what exceeds the default max ammo amount for each weapon. It would be good to not allow the plugin to exceed the default max ammo amount on pick up and to not allow pick up, when max ammo limit is met.

    2) could You make so the ammo box is dropped always at the front of the player, not at random directions?

    3) also the entity spawn position seems to be too high (EyePosition), what temporarily lowers the client's view position, when weapon+ammo box is dropped

    4) could You make the throw power weaker, to make the ammo box land much closer to the weapon?

    5) maybe change the pick up sound to "items/itempickup.wav" (btw, why the plugin is not caching sounds from "hl2/sound/items/" dir?).

    ED:
    There's a little mistake in sm_ammopickup_delaydrops Cvar description:

    Quote:
    - Delay ammo drops until mp_freezetime has expired? 1=yes, 0=no'

    Last edited by GrO; 12-14-2011 at 03:01.
    GrO is offline
    Peace-Maker
    SourceMod Plugin Approver
    Join Date: Aug 2008
    Location: Germany
    Old 12-14-2011 , 03:15   Re: [CS:S] Ammo Pickup
    Reply With Quote #3

    Nice to see you made it. Now that we put soo much effort into those weapon ammo stocks, you don't even need them

    Regarding 1) You could use the GiveAmmo method to handle the limits:
    PHP Code:
    /**
         * GiveAmmo gives ammo of a certain type to a player - duh.
         *
         * @param client        The client index.
         * @param ammo            Amount of bullets to give. Is capped at weapon's limit.
         * @param ammotype        Type of ammo to give to player.
         * @param suppressSound Don't play the ammo pickup sound.
         * 
         * @return Amount of bullets actually given.
         */
        
    new ret SDKCall(g_hGiveAmmoclient30ammoTypetrue); 
    Attached Files
    File Type: txt giveammo.txt (145 Bytes, 616 views)
    File Type: sp Get Plugin or Get Source (giveammo.sp - 1568 views - 1.8 KB)
    __________________
    Peace-Maker is offline
    GrO
    Veteran Member
    Join Date: Jun 2010
    Location: Poland
    Old 12-14-2011 , 03:41   Re: [CS:S] Ammo Pickup
    Reply With Quote #4

    Quote:
    Originally Posted by Peace-Maker View Post
    Regarding 1) You could use the GiveAmmo method to handle the limits
    Will this also block the ammo box pick up, when the max overall ammo amount is met?

    Last edited by GrO; 12-14-2011 at 03:42.
    GrO is offline
    Peace-Maker
    SourceMod Plugin Approver
    Join Date: Aug 2008
    Location: Germany
    Old 12-14-2011 , 04:00   Re: [CS:S] Ammo Pickup
    Reply With Quote #5

    Quote:
    Originally Posted by GrO View Post
    Will this also block the ammo box pick up, when the max overall ammo amount is met?
    Depends on how TnTSCS implements it. Only removing the amount of ammo GiveAmmo returns would do the job.
    __________________
    Peace-Maker is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 12-14-2011 , 09:30   Re: [CS:S] Ammo Pickup
    Reply With Quote #6

    @Peace-Maker - I know, I didn't use that weapon ammo stock in this, but I'm going to include the much more simpler version of the ammo pickup plugin that does use that stock. This one was requested to have the ammo boxes drop so I did it a different way.

    As to the limits and using the GiveAmmo (thanks btw), I'll mess around with that and check it out. I could put a CVar in so server admins can determine if they want to limit the extra rounds players can pick up to the game allowed maximum or not. The visual maximum of "extra ammo" is 999 - it rolls over after that, but doesn't max out - well, it might "max" out, but I picked up something like 1200 rounds for the m4a1 during my testing.

    Thank you for the feedback - always appreciated. I might change this plugin to use the CS_GetDroppedWeaponAmmo, but SDKHooks OnWeaponDropPost is still too fast, the dropped weapon stock returns that the weapon isn't dropped... maybe I'll use a timer or other method...

    Quote:
    Originally Posted by GrO View Post
    Will this also block the ammo box pick up, when the max overall ammo amount is met?
    Yes Also, if the ammo box has 80 rounds and the player already has 50 rounds, and the max ammo for the weapon they have holds 90 rounds, then they'll pickup 40 of the 80 and the ammo box will remain, but only have 40 rounds left.

    Last edited by TnTSCS; 12-14-2011 at 09:32.
    TnTSCS is offline
    GrO
    Veteran Member
    Join Date: Jun 2010
    Location: Poland
    Old 12-14-2011 , 13:13   Re: [CS:S] Ammo Pickup
    Reply With Quote #7

    Quote:
    Originally Posted by TnTSCS View Post
    Also, if the ammo box has 80 rounds and the player already has 50 rounds, and the max ammo for the weapon they have holds 90 rounds, then they'll pickup 40 of the 80 and the ammo box will remain, but only have 40 rounds left.
    Great to hear this. What about the other points from my post, are You able to implement them?
    GrO is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 12-14-2011 , 15:40   Re: [CS:S] Ammo Pickup
    Reply With Quote #8

    Yes. Sorry I should have done a point by point. I'm working on all of your suggestions. I'm at work now so don't expect for a few hours

    Last edited by TnTSCS; 12-14-2011 at 15:41.
    TnTSCS is offline
    GrO
    Veteran Member
    Join Date: Jun 2010
    Location: Poland
    Old 12-14-2011 , 16:26   Re: [CS:S] Ammo Pickup
    Reply With Quote #9

    Quote:
    Originally Posted by TnTSCS View Post
    Yes. Sorry I should have done a point by point. I'm working on all of your suggestions. I'm at work now so don't expect for a few hours
    Roger that.
    GrO is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 12-14-2011 , 22:46   Re: [CS:S] Ammo Pickup
    Reply With Quote #10

    Issue 1

    Fixed - new CVar - sm_ammopickup_maxammo that you can use to tell the plugin to abide by max ammo if you want to use that feature. If the player doesn't pick up all of the ammo dropped, the left over ammo will remain with that ammo box model.

    Issue 2

    I moved it to spawn at the player's feet.

    Issue 3

    I moved it to spawn at the player's feet.

    Issue 4

    It will only move if the player has momentum or on a hill when the ammo drops now.

    Issue 5

    Fixed - now the pick up sound is the itempickup.wav and it is precached

    Unnumbered Issue

    Fixed - thanks

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

    Updating OP now - if you have Updater, it should update shortly.

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

    Version 0.2.2.2
    Version 0.2.2.2 - Now requires the attached giveammo.txt gamedata file
    *Fixed issues brought up by GrO and Peace-Maker (http://forums.alliedmods.net/showpos...79&postcount=2)
    - special thanks to Peace-Maker for providing the giveammo gamedata and example
    *Added CVar for AbideByMaxAmmo so server admins can choose how they'll handle the ammo pickup

    Last edited by TnTSCS; 12-14-2011 at 22:54.
    TnTSCS is offline
    Reply


    Thread Tools
    Display Modes

    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 14:34.


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