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

[REQ] HEGrenade Give with optional rate/delay?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Da_maniaC
Junior Member
Join Date: Jul 2011
Old 11-12-2011 , 12:28   [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #1

Hi there,

I am looking for a plugin/script that will give players 1 HEGrenade when they spawn. Then if they use it they will get a new grenade after 'n' amount of time.

I have tried a few "Unilimited HEgrenades/Grenades" plugins/scripts but those either hit you with 999 grenades instantly, or don't have a delay that can be customised.

Any help would be appreciated!

Last edited by Da_maniaC; 11-12-2011 at 12:29.
Da_maniaC is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-12-2011 , 13:13   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fun>
#include <csx>
#include <hamsandwich>

#define VERSION "0.0.1"
#define PLUGIN "Automatic HeGrenade"

new g_pCvarGiveDelay

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
RegisterHam(Ham_Spawn"player""GiveHeGrenade"true)
    
g_pCvarGiveDelay register_cvar("amx_auto_he_delay""5.0")
}

public  
grenade_throw(idgrenade_indexgrenade_type)
{
    if( 
grenade_type == CSW_HEGRENADE && is_user_alive(id) )
    {
        
set_task(get_pcvar_float(g_pCvarGiveDelay), "GiveHeGrenade"id)
    }
}

public 
GiveHeGrenadeid )
{    
    if( 
is_user_alive(id) && !user_has_weapon(idCSW_HEGRENADE) )
    {
        
give_item(id"weapon_hegrenade")
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-12-2011 at 13:44.
ConnorMcLeod is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-12-2011 , 13:16   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #3

PHP Code:
public GiveHeGrenadeid 
=>
PHP Code:
public Task_GiveHeGrenadeid 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-12-2011 , 13:45   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #4

No, because i decided to use the same callback in task an fot spawn, but mistake was in set_task native, fixed, thanks.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-12-2011 , 14:47   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
No, because i decided to use the same callback in task an fot spawn, but mistake was in set_task native, fixed, thanks.
Didn't notice spawn
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Da_maniaC
Junior Member
Join Date: Jul 2011
Old 11-12-2011 , 14:48   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #6

Wow, thanks a lot for the script and quick response!

Now for some noobs questions....
Do i put this in a .py or .txt file and load the filename in autoexec.cfg?

Last edited by Da_maniaC; 11-12-2011 at 14:48.
Da_maniaC is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-12-2011 , 16:49   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #7

You put it in a .sma file and you compile it with compile.exe from default amxx package amxmodx/scripting/
Then you declare the .amxx compiled file in plugins.ini

You can compile online there : http://webcomp.ak-team.com/
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Da_maniaC
Junior Member
Join Date: Jul 2011
Old 11-12-2011 , 17:51   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #8

Thanks!

But now im thinking there might have been some confusion from my part.
Does this work with CSS? I'm reading that AMX MOD X is actually for CS (and Sourcemod was made to replace it for CSS).

I guess i should have stated that more clearly when making my initial post.

Is there any way to do the same thing for CSS?
Da_maniaC is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-12-2011 , 18:14   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #9

Post in sourcemod forum then ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Da_maniaC
Junior Member
Join Date: Jul 2011
Old 11-12-2011 , 19:09   Re: [REQ] HEGrenade Give with optional rate/delay?
Reply With Quote #10

I posted there now ... thanks for all the effort tho!

Last edited by Da_maniaC; 11-12-2011 at 19:09.
Da_maniaC 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 07:32.


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