PDA

View Full Version : [REQ] HEGrenade Give with optional rate/delay?


Da_maniaC
11-12-2011, 19:08
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 (http://addons.eventscripts.com/addons/view/infinite_grenades)/scripts (http://forums.alliedmods.net/showthread.php?p=909115) but those either hit you with 999 grenades instantly, or don't have a delay that can be customised.

I also found this (http://forums.alliedmods.net/showthread.php?t=168747&highlight=grenade) when i searched these forums, but if i try to compile it I get error messages.

Any help would be appreciated!

TnTSCS
11-13-2011, 00:01
I can hook you up with something. Did you want them to get another nade after X seconds of detonation of the one they're given at spawn?

Da_maniaC
11-13-2011, 10:56
Hi there,

Thanks for the reply. :)
What im looking for:

- Players get 1 hegrenade when they spawn.
- When they throw it, they will not get another grenade until 'x' number of seconds have passed since they threw it.

I would like the time to be configurable, because i want to go try and see what will work best (in essence i want players to have continuous grenades, but if they get one too quickly they can start spamming them...which is what i want to avoid).

TnTSCS
11-13-2011, 11:16
okay... I'll code this right quick - off for a run, then I'll code it

Da_maniaC
11-13-2011, 13:06
Awesome man, thanks. :)

TnTSCS
11-13-2011, 13:11
Okay... done :)

A little more involved than I first though. And I made it a little VIP-ish if you care to use it.

Only players with CUSTOM1 flag will be given an hegrenade at spawn. You can override this to include any player by adding the following into your admin_overrides.cfg:

"give_unlimitedhe_allow" ""
or if you want only those with CUSTOM4 it would be:
"give_unlimitedhe_allow" "r"

There's also an admin command you can use to toggle this plugin on or off (admin flag is set to generic, but you can override this in admin_overrides.cfg):
sm_unlimitedhe
Usage: sm_unlimitedhe <1/0>
1=ON, 0=OFF

A config file will be created in your cstrike/cfg/sourcemod called UnlimtedHE.plugin.cfg. In that file you can set your variables:

sm_unlimitedhe_delay
"sm_unlimitedhe_delay" = "15" ( def. "15" ) min. 0.100000 max. 300.000000
- Number of seconds to wait after HE detonation to give player a new hegrenade

sm_unlimitedhe_enabled
"sm_unlimitedhe_enabled" = "1" min. 0.000000 max. 1.000000
- 1=enabled, 0=disabled


-----------
reuploaded .sp due to spelling error in command reply

Da_maniaC
11-13-2011, 18:35
Hey,

Thanks a lot for all your help man! :)

I put the .smx file in cstrike/addons/sourcemod/plugins and the cfg file was generated.
I put in these settings (to test):

// This file was auto-generated by SourceMod (v1.4.0)
// ConVars for plugin "UnlimitedHE.smx"


// Number of seconds to wait after HE detonation to give player a new hegrenade
// -
// Default: "15"
// Minimum: "0.100000"
// Maximum: "300.000000"
sm_unlimitedhe_delay "1"

// 1=enabled, 0=disabled
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_unlimitedhe_enabled "1"

// The version of 'Unlimited HE'
// -
// Default: "1.0.0"
sm_unlimitedhe_version "1.0.0"

// The version of SourceMod that 'Unlimited HE' was compiled with.
// -
// Default: "1.4.1-dev"
sm_unlimitedhe_version_build "1.4.1-dev"

My admin_overrides.cfg looks like this:

Overrides
{
/**
* By default, commands are registered with three pieces of information:
* 1)Command Name (for example, "csdm_enable")
* 2)Command Group Name (for example, "CSDM")
* 3)Command Level (for example, "changemap")
*
* You can override the default flags assigned to individual commands or command groups in this way.
* To override a group, use the "@" character before the name. Example:
* Examples:
* "@CSDM" "b" // Override the CSDM group to 'b' flag
* "csdm_enable" "bgi" // Override the csdm_enable command to 'bgi' flags
*
* Note that for overrides, order is important. In the above example, csdm_enable overwrites
* any setting that csdm_enable previously had.
*
* You can make a command completely public by using an empty flag string.
*/
}

"give_unlimitedhe_allow" ""

Right now, the mod seems to be running...but i am not getting a new grenade automatically.

http://members.home.nl/djthesp/listplugins.jpg

Am i doing something wrong? :)

TnTSCS
11-13-2011, 20:04
yes... put the "give_unlimitedhe_allow" "" in the {}'s


Overrides
{
/**
* By default, commands are registered with three pieces of information:
* 1)Command Name (for example, "csdm_enable")
* 2)Command Group Name (for example, "CSDM")
* 3)Command Level (for example, "changemap")
*
* You can override the default flags assigned to individual commands or command groups in this way.
* To override a group, use the "@" character before the name. Example:
* Examples:
* "@CSDM" "b" // Override the CSDM group to 'b' flag
* "csdm_enable" "bgi" // Override the csdm_enable command to 'bgi' flags
*
* Note that for overrides, order is important. In the above example, csdm_enable overwrites
* any setting that csdm_enable previously had.
*
* You can make a command completely public by using an empty flag string.
*/
"give_unlimitedhe_allow" ""
}

Let me know if that fixes things. You should get a new grenade 1 second after one that you throw detonates though... you just wouldn't get one at spawn until you fix the above

Da_maniaC
11-14-2011, 17:25
The script is working, thanks a lot! :)

But earlier on there seemed to be something wrong with the way bots we're picking up grenades in their inventory (they would just drop on the ground): Click (http://cloud.steampowered.com/ugc/648745380516426309/40C2215B803468D5EAB8B3D74B09EEB2644A3B2F/).
I changed the cssdm.cfg to make no one start out with a grenade in the inventory.
At first, after a restart it didn't seem to make a different but now it seems to be fine... :)

TnTSCS
11-14-2011, 19:05
ya... since cssdm gives you the option to give everyone a grenade at spawn, and my plugin allows that as well, each person could potentially be given two grenades and if you don't allow more than 1 grenade, they'll just drop the second one.

Either disable the cssdm part, or I could add to this plugin by putting a variable to enable giving a nade at spawn...

either way will work.

Da_maniaC
11-15-2011, 08:25
ya... since cssdm gives you the option to give everyone a grenade at spawn, and my plugin allows that as well, each person could potentially be given two grenades and if you don't allow more than 1 grenade, they'll just drop the second one.

Either disable the cssdm part, or I could add to this plugin by putting a variable to enable giving a nade at spawn...

either way will work.

I changed the cssdm config, so it no longer gives you a grenade on spawn.
Everything is working fine now. Thanks again! :)