Raised This Month: $51 Target: $400
 12% 

[TF2] Weapon Steal (3.0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Plugin ID:
3832
Plugin Version:
3.0
Plugin Category:
Gameplay
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allow players to steal weapons from killed ennemy.
    Old 08-09-2013 , 14:42   [TF2] Weapon Steal (3.0)
    Reply With Quote #1

    Description :

    Okay, this plugin can be totally funny (seeing a scout with a minigun isn't usual) and change gameplay.
    It allows you to pickup weapons from killed ennemy.

    Commands & Cvar :

    No commands

    No Cvar

    Installation :

    1) Put WeaponStealV2.smx (DON'T USE THE 'OLD.zip' ARCHIVE! Unless you want a old crappy version of this plugin) in your plugin folder : sourcemode/plugins
    2) Restart server, reload map or reload plugins folder.
    3) ???
    4) Walk on a weapon and enjoy !
    NOTE: You will need to install this plugin, otherwise, you won't be able to run mine.

    If you want to compille it manually :

    Require the library tf2items_giveweapon and kvizzle.

    What I plan to do ?
    - Sometimes, a wrong weapon is stealed (exemple : walk on a minigun, you will get 'Natasha')
    - Let the user the choice of stealing a wep or not.
    - Restrict to admins / donators ?
    - Command and cvar

    Request :

    None for the moment... feel free to ask !


    Logs :
    3.0 : Fully rewrite all the plugin. Less code.

    Old version of the plugin, I won't blame if you use it ;)
    Spoiler
    Attached Files
    File Type: zip OLD.zip (26.2 KB, 369 views)
    File Type: smx WeaponSteal.smx (12.4 KB, 717 views)
    File Type: sp Get Plugin or Get Source (WeaponSteal.sp - 501 views - 2.5 KB)
    __________________
    Want to check my plugins ?

    Last edited by Arkarr; 07-15-2014 at 07:10. Reason: Updated to 3.0
    Arkarr is offline
    7106
    Senior Member
    Join Date: Jun 2013
    Old 08-11-2013 , 06:54   Re: [TF2] Weapon Steal (1.1)
    Reply With Quote #2

    i dont know y it doesn't workin'
    7106 is offline
    Arkarr
    Veteran Member
    Join Date: Sep 2012
    Location: Just behind my PC screen
    Old 08-11-2013 , 07:46   Re: [TF2] Weapon Steal (1.1)
    Reply With Quote #3

    Quote:
    Originally Posted by 7106 View Post
    i dont know y it doesn't workin'
    What doesn't work ?
    __________________
    Want to check my plugins ?
    Arkarr is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 08-14-2013 , 12:59   Re: [TF2] Weapon Steal (1.2)
    Reply With Quote #4

    This is pretty cool, though it looks like you're giving the weapons on kill/death rather than on pickup (of a dropped weapon).

    If you know how, I'd say you should give that a try: when a player walks over the dropped "weapon" (ammo), they pick it up, instead of on death. Try SDKHooks' touch functions for that, as I don't think tf_ammo_pack's outputs or the item_pickup event will suffice. Good luck.

    Why, again, aren't renamed (Upgradeable) and stranges working? The indices work fine in GiveWeapon (with the latest update, at least).
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.

    Last edited by FlaminSarge; 08-14-2013 at 13:00.
    FlaminSarge is offline
    Arkarr
    Veteran Member
    Join Date: Sep 2012
    Location: Just behind my PC screen
    Old 08-14-2013 , 15:10   Re: [TF2] Weapon Steal (1.2)
    Reply With Quote #5

    Well, I thinked about this option. I just needed some infos, and now I just got it !! Thanks a lot, I will probably update it in about 3 days...

    Quote:
    Why, again, aren't renamed (Upgradeable) and stranges working? The indices work fine in GiveWeapon (with the latest update, at least).
    Actually I don't know, it does work for some weapons only (tested : Loch-n-load and The Liberty Launcher) but other weapons appears something like this "Upgradable TF_WEAPON_[WEAPON-NAME]" with a invalid weapon index. Any idea why ?
    __________________
    Want to check my plugins ?
    Arkarr is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 08-14-2013 , 18:14   Re: [TF2] Weapon Steal (1.2)
    Reply With Quote #6

    You're using "weaponindex" as a global variable, where you need to use it as a global array of variables (so each client has their own weapons).

    Change it to "new weaponindex[MAXPLAYERS + 1]" to make it an array that has enough space to store a weaponindex for each client (I'd use "new weaponindex[MAXPLAYERS + 1] = { -1, ... };" so that it sets it to -1 for everyone automatically when the plugin is first loaded).
    Then, any time you use weaponindex, instead use the weaponindex array element for the client involved ("weaponindex[client]"). Before you actually use it, however, you should check to make sure it's greater than or equal to 0, so that people who have not killed anybody (and will have -1 as their weaponindex[client]) won't get anything.

    Understand? Make sure you understand what these changes mean, if you're going to learn how to program plugins/anything, instead of just following the instructions.

    Also, you're using public Action:Steal_Menu(client, args). While it's not breaking the plugin, you've got it named and set up as if it were a command callback instead of just a generic function, and you pass in Steal_Menu(client, weaponindex) in the death hook. That means that you're setting the "args" parameter to the value of weaponindex (but you never end up using it). Since you're storing the weaponindex in the global array already, you don't need this, and you can name the function "stock Steal_Menu(client)" and call it with Steal_Menu(client).
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.

    Last edited by FlaminSarge; 08-14-2013 at 18:17.
    FlaminSarge is offline
    Arkarr
    Veteran Member
    Join Date: Sep 2012
    Location: Just behind my PC screen
    Old 08-15-2013 , 02:36   Re: [TF2] Weapon Steal (1.2)
    Reply With Quote #7

    It wasn't my first plugin but it appears to looks like . Okay thanks for precision. I already know this "client variable" but I thought it wasn't necessary. I will include this changes in the update. Thanks !
    __________________
    Want to check my plugins ?
    Arkarr is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 08-15-2013 , 14:05   Re: [TF2] Weapon Steal (2.0*)
    Reply With Quote #8

    After you call TF2Items_GiveWeapon and give the weapon, you can set weaponindex[client] back to -1 so that next time they pick up the ammo pack, it's not given.

    Also, if you can figure out a way to get the entity of the item_pickup event, you can drop this system entirely and use m_nItemDef from the tf_ammo_pack entity to determine the weapon index. But that is ONLY if you can find the entity, which I'm not sure you can at the moment.
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.
    FlaminSarge is offline
    Arkarr
    Veteran Member
    Join Date: Sep 2012
    Location: Just behind my PC screen
    Old 08-15-2013 , 14:23   Re: [TF2] Weapon Steal (2.0*)
    Reply With Quote #9

    Quote:
    Originally Posted by FlaminSarge View Post
    After you call TF2Items_GiveWeapon and give the weapon, you can set weaponindex[client] back to -1 so that next time they pick up the ammo pack, it's not given.

    Also, if you can figure out a way to get the entity of the item_pickup event, you can drop this system entirely and use m_nItemDef from the tf_ammo_pack entity to determine the weapon index. But that is ONLY if you can find the entity, which I'm not sure you can at the moment.
    Okay, thanks. Can't do the changes now. But, sure ! I will do this.
    __________________
    Want to check my plugins ?
    Arkarr is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 08-17-2013 , 00:18   Re: [TF2] Weapon Steal (2.0*)
    Reply With Quote #10

    Also, if you want to *try*, you can look for an SDKHooks "Touch" hook right before the itempickup event. While it may take a bit of working to get it to detect properly, you can get the entity from the "touch" hook and then use the item_pickup to determine if they actually picked up the entity in question.
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.

    Last edited by FlaminSarge; 08-17-2013 at 00:18.
    FlaminSarge is offline
    Reply



    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 08:58.


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