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

Instant Grenades Throwing [Version 1.5]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   Hawk552 (427)
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-03-2009 , 08:55   Instant Grenades Throwing [Version 1.5]
Reply With Quote #1

Instant Grenades Throwing
Version 1.5
by Dores
Tested on CS 1.6.


Description:


Allows a player to instantly throw grenades, if the weapon he is holding is not a grenade.
It will switch to the wanted grenade(if he has it) and will immediately, without a delay, throw it.
You can also throw different kinds of grenades one by another without a delay, like flashabangs.

Added new features:

1. Now there are 2 types of throwing(for changing types go to Commands):
  • Auto Throw - Automatically throws the grenade when nade_throw was sent.
  • Hold - Holds the grenade with the pin pulled and releases it when the player uses the command again.
2. Nade Choosing:
  • Each player toggles which grenade does he want to instantly throw by using a command(@ Commands).
  • No arguments for nade_throw. Just use the command, and it will throw the grenade you chose(unless you don't have it).
  • A small HUD sprite will be shown near the timer, that shows what grenade is the player using right now and changes according to the player's choice.
3. Added help MOTDs. Help is changed if Nade Choosing is enabled.

4. Added a sound and a notify text when choosing a grenade(in Nade Choosing).

5. Added Multi-Lingual support(help MOTDs are in English).

6. Changed the IsGrenade() stock to a define(thanks ConnorMcLeod).

7. Fixed where +attack remained when players switched weapons while holding the pin-pulled grenade.

8. Removed the round start hook and instead hooked player spawn using HamSandwich(included the HamSandwich module).

9. Nade Choosing can now be used whenever the players want without the need to enable it and re-compile the plugin. It's now considered as a built-in feature that may be used when wanted.

10. Fixed a "new line" HTML tag(<br />) in the help MOTDs.

11. Removed 2 lines from ML that can only be done in English.

12. Forgot changing 2 messages to ML.

13. Minor code improvements, thanks Hawk552.

14. Added auto grenade switch after throwing a grenade(only switches the grenade that will be thrown next time by using the "nade_throw" command).
Thanks Costin83 for the idea.

15. Forgot to include the updated .amxx file in the .zip file.

To instantly throw a grenade, players should bind keys to(don't use 'f'/'s'/'h' if you want to throw a chosen grenade):
  • nade_throw
    • f - Instantly throws flashbangs.
    • h - Instantly throws HE grenades.
    • s - Instantly throws smoke grenades.
Example: bind f "nade_throw h"(or to throw the chosen grenade: bind f "nade_throw").
Now with f I can instantly throw HE grenades/the chosen grenade.


CVars:
  • INT_on - Toggles the plugin.
  • INT_flash - [Dis]Allows flash from being instantly thrown.
  • INT_he - [Dis]Allows HE from being instantly thrown.
  • INT_smoke - [Dis]Allows smoke from being instantly thrown.
  • INT_icons - [Dis]Allows showing the chosen grenade's hud icon near the timer.
  • INT_auto_switch - [Dis]Allows auto switching the grenade that will be thrown next time by "nade_throw" after a grenade thrown. [Default: 1]
Commands:
  • nade_throw <nade> - The command that instantly throws a specific grenade(take a look at plugin description).
  • Note: Don't put anything instead of 'nade' to throw the chosen grenade.
  • amx_INT_unallow <player's partial name> <1 | 0> - Allows(1)/Disallows(0) a specific player to instantly throw grenades. Requires ADMIN_KICK flag.
  • amx_INT_unallowed - Shows in console all players that are unallowed to instantly throw grenades. This is good for admins that don't remember/know who is unallowed.
  • nade - Changes the player's throwing/chosen grenade. It's changing order is as follows: HE --> Flash --> Smoke --> HE --> etc...(sprite changes according to the choice, if INT_icons is 1, as said above). Should be bound to a key.
  • nade_throw_type - Changes the throwing type(look up the post for types). Should be bound to a key.
  • say /int_help - Shows information and explanation about the plugin.
  • say /int_help2 - Shows further information and explanation about the plugin.
A couple of notes:

  1. An unallowed player will stay unallowed until he disconnects or amx_INT_unallow <player's name> 0 will be executed. He won't be allowed on new round.
Installation:

  1. Download the .zip file and extract the folders to the cstrike/czero folder(haven't tested the plugin on other mods).
  2. Go to addons/amxmodx/configs and open plugins.ini.
  3. At the last line, put: instant_grenade_throw.amxx debug
P.S:

Thanks Exolent[jNr] and arkshine for optimizing a bit the nade_throw function.
Thanks Bugsy for reminding me to create a holding-grenade feature.
Thanks HiSS for Nade Choosing idea.


Required Modules:

FakeMeta
HamSandwich



Current Languages:

  1. EN - by me.
  2. DE - by ExKiLL.
  3. NL - by crazyeffect.
  4. ES - by HiSS.
  5. FR - by arkshine.
  6. SV - by DarkGod.
  7. LT - by Calibras, fixed by hleV.
  8. RO - by Mitiq.
To add a translation, check this out.


Enjoy.
Attached Files
File Type: zip instant_grenade_throw.zip (30.8 KB, 1819 views)
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 11-07-2010 at 13:28. Reason: Version 1.5
Dores is offline
HiSS
Member
Join Date: Nov 2008
Location: Celtic Gallaecia
Old 02-03-2009 , 09:12   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #2

Good idea, I'll try this.

Suggestion:
Why not add a key to select grenade, and other key to throw them (like in far cry, etc) ?

You should add sprite icon in the screen to view current selected grenade.

Greetings.
__________________
[IMG]http://img227.**************/img227/3148/celeritasetsubtilitasuw0.jpg[/IMG]
HiSS is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-03-2009 , 09:16   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #3

Code:
Now with f I can instantly throw HE grenades.
i think flashbangs
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 02-03-2009 , 09:21   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #4

Actually HE.
Quote:
Originally Posted by Dores View Post
Example: bind f "nade_throw h"

"nade_throw h" = throw hegrenade.
f = the key that's getting bind
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-03-2009 , 09:47   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #5

Quote:
Originally Posted by HiSS View Post
Good idea, I'll try this.

Suggestion:
Why not add a key to select grenade, and other key to throw them (like in far cry, etc) ?

You should add sprite icon in the screen to view current selected grenade
Hmm pretty good idea. Actually, games like Far Cry are what I'm trying to simulate.
I'll think of it, thanks.

Could anyone please test and report?
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 02-03-2009 at 09:49.
Dores is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2009 , 10:06   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #6

Quote:
Originally Posted by Dores View Post
Hmm pretty good idea. Actually, games like Far Cry are what I'm trying to simulate.
I'll think of it, thanks.

Could anyone please test and report?
It would be cool if you press the bound key and that held the grenade and thrown when the key is released. Perhaps have different throw methods to suit different peoples tastes?
__________________

Last edited by Bugsy; 02-03-2009 at 10:08.
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-03-2009 , 10:59   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #7

I don't know if it's usefull for you, here is the way i made to simulate the bug when you watch HLTV demos and the animation doesn't draw + added instant usable nades :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Instant Nade"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define    m_pPlayer                41
#define    m_flNextPrimaryAttack    46
#define    m_flTimeWeaponIdle        48

#define    m_flNextAttack            83

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Item_Deploy"weapon_hegrenade""CGrenade_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_smokegrenade""CGrenade_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_flashbang""CGrenade_Deploy"1)
}

public 
CGrenade_DeployiEnt )
{
    new 
id get_pdata_cbase(iEntm_pPlayer4)
    
set_pdata_float(idm_flNextAttack0.0)

    
set_pdata_float(iEntm_flNextPrimaryAttack0.04)
    
set_pdata_float(iEntm_flTimeWeaponIdle0.04)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-03-2009 , 11:28   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
It would be cool if you press the bound key and that held the grenade and thrown when the key is released.
I tried to do it, but there's a problem.
A player can't hold a button that is bound to a command and execute the command more than once.
That's why I can't tell if the player is holding the bounded key or not. I'll have to find a workaround for it.


@Connor:

That code is very useful, but if you take a look in my plugin, you can see that I've used m_flNextAttack and made the player pull the pin straight away, so I don't really care about animations.

But this is still very cool and I always wanted to make it look like a demo in real-time game. Thanks, +karma.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 02-03-2009 at 11:36.
Dores is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 02-03-2009 , 12:23   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #9

Sounds nice. Gotta look at the code, I think there's something interesting.
Btw, just a thought, you could use IN_RELOAD too, cause there wouldn't be need for binding, and you can't reload a grenade so... Though if you want that you can throw them while holding other gun, then it wouldn't fit. IN_RELOAD is called even you are holding a grenade? I think it is.
SnoW is offline
Send a message via MSN to SnoW
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 02-03-2009 , 12:29   Re: Instant Grenades Throwing [Version 1.0]
Reply With Quote #10

Sounds cool

Because you have so many messages, you could make it ML?
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
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 17:02.


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