AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds] (https://forums.alliedmods.net/showthread.php?t=282686)

OciXCrom 05-14-2016 16:08

Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
3 Attachment(s)

Description
  • This plugin allows you to change the messages which show up when you throw a grenade (fire in the hole), to add custom trail with different colors, as well as different sounds for every grenade there is or completely block them.

Images

http://i.imgur.com/Iw0oG1i.jpg

http://i.imgur.com/y40w0KW.jpg
http://i.imgur.com/5KQiZfv.jpg
http://i.imgur.com/fSVxmon.jpg
http://i.imgur.com/ZhHTvtf.jpg
http://i.imgur.com/WSwbRZw.jpg
http://i.imgur.com/fKW9zOm.jpg
http://i.imgur.com/X1kzaGd.jpg

Settings
  • The settings can be changed from the file configs/FireInTheHole.ini:

    [Messages = 1] - In this section you can find and modify the grenade messages. Set it to "0" if you want to disable them and use the default ones.
    • MSG_HE: The message when you throw a HE grenade.
    • MSG_FLASH: The message when you throw a Flash grenade.
    • MSG_SMOKE: The message when you throw a Smoke grenade.
    • MSG_SHOW_TYPE: Which players should be able to see the messages?
      • "0" = disable messages completely.
      • "1" = only the player who threw the grenade.
      • "2" = only teammates.
      • "3" = all players.
    • MSG_ADMIN_LISTEN: Whether admins should see other team's messages if MSG_SHOW_TYPE = 2.
    • MSG_ADMIN_FLAG: The admin flag for the setting above.
    • MSG_TEAM_T: Used when %team% is applied.
    • MSG_TEAM_CT: Used when %team% is applied.
    • MSG_TEAM_SPEC: Used when %team% is applied.

    [Sounds = 0] - Change it to "1" if you want to enable custom sounds when you throw a grenade. You can leave a field blank if you want that grenade to be without a sounds. Leave them all blank if you want to completely block the "fire in the hole" sound.
    • SOUND_HE: The sound when you throw a HE grenade.
    • SOUND_FLASH: The sound when you throw a Flash grenade.
    • SOUND_SMOKE: The sound when you throw a Smoke grenade.
    • SOUND_PLAY_TYPE: Who should hear the sound?
      • "0" = nobody, disables sounds completely.
      • "1" = only the player who threw the grenade.
      • "2" = only teammates.
      • "3" = all players.


    [Trail = 1] - Here you can moidfy the grenades' trail. Set it to "0" if you want to disable it. Use "R" if you want the given value of the color to be random (Example: 255 R 150 or R R R).
    • TRAIL_HE: The trail when you throw a HE grenade.
    • TRAIL_FLASH: The trail when you throw a Flash grenade.
    • TRAIL_SMOKE: The trail when you throw a Smoke grenade.
    • TRAIL_SPRITE: The sprite for the trail.
    • TRAIL_LIFE: Trail duration.
    • TRAIL_WIDTH: Trail width.
    • TRAIL_BRIGHTNESS: Trail brightness.
    • TRAIL_SHOW_TYPE: Who can see the trail?
      • "0" = everybody.
      • "1" = only the player who threw the grenade.
      • "2" = only teammates.

    [Glow = 1] - This section allows you to make grenades glow after they are thrown in the air. Use "R" if you want the given value of the color to be random (Example: 255 R 150 or R R R).
    • GLOW_HE: Glow for HE Grenade.
    • GLOW_FLASH: Glow for Flash Grenade.
    • GLOW_SMOKE: Glow for Smoke Grenade.
    • GLOW_BRIGHTNESS: Glow brightness.
    • GLOW_TYPE: Glow type ("0" = don't apply invisibility to the grenade).

    [Explode = 0] - Here you can change the time it takes for a grenade to explode after it has been thrown.
    • EXPLODE_HE: Explosion time for HE Grenade.
    • EXPLODE_FLASH: Explosion time for Flash Grenade.
    • EXPLODE_SMOKE: Explosion time for Smoke Grenade.

https://raw.githubusercontent.com/Oc...using_this.png
https://raw.githubusercontent.com/Oc...plugin_lab.png
https://raw.githubusercontent.com/Oc...ad_default.png

ComedyShotsGamer 05-14-2016 17:20

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
Nice Plugin good Idea!

EFFx 05-14-2016 19:26

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
whats the difference between others plugins? .ini file?

Bugsy 05-14-2016 20:09

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
This one also exists: https://forums.alliedmods.net/showthread.php?p=401813

But yours has more configuration\customization.

EFFx 05-14-2016 21:15

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
Exactly!

OciXCrom 05-15-2016 08:17

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
Quote:

Originally Posted by EFFx (Post 2419067)
Exactly!

Exactly as well. It has many things you can customize and it's far more easier to make changes to it in comparison with the other one(s). I know there's already a plugin for grenade messages and another one for grenade trail, but I think that these things should be combined together and made easy to modify. The downside of "Descriptive Fire in the Hole" is that it has got no cvars/cfg file at all and users need to modify the .sma file in order to make changes. In comparison with "Grenade Trail", this one allows you to modify the sprite, width, duration and brightness, as well as set a random color for each grenade/color value, instead of doing it for all of them at once. I also included an option to add a different "fire in the hole" sound for each grenade, which I wasn't able to find in any other plugin. It also enables you to block the sound completely, which is another highly requested modification. I would probably add even more options to this one, since I named it "ultimate", so let me know if you have any suggestions.

GordonFreeman (RU) 05-15-2016 08:50

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
gj

siriusmd99 05-15-2016 09:28

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
This could be approved ,it has sounds, trail colorchat messages to customize. It's very useful for many servers...

OciXCrom 05-15-2016 10:26

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
I'm glad that you like it. I added more options to it:

  • Added a glow section, from where you can activate grenade glow on thrown grenades.
  • You can customize the glow for every grenade, as well as make it random.
  • You can even make the grenades look like this - http://i.imgur.com/fKW9zOm.jpg
  • Added an option to configure which players can see the grenade messages: nobody, only the player who threw the grenade, only teammates, or all players.
  • You can make admins with a specified flags use "admin listen" to see other team's grenade messages.
  • You can now use %team% in the messages to show the player's team (the team names are also customizable).
  • Added an option to configure which players can hear the sounds: nobody, only the player who threw the grenade, only teammates, or all players.
  • Fixed a small but annoying mistake - all players could see everyones' messages/sounds.

HamletEagle 05-15-2016 12:05

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Sounds]
 
Yeah, that's something with more functionalities, so I'm okay with it.

As per usual, firstly what I saw at a quick glance:
  • In fileRead:
    • strlen(szData) should be cached.
    • You should add some checks for data validity inside configuration file. Like, when you get the color for message, it can be from 3 to 6, everything that is outside this is invalid. For this, use clamp:
      PHP Code:

      clamp(str_to_num(szValue), 36

      How this works? Anything lower than 3 is converted to 3, everything bigger than 6 becomes 6, so you don't get invalid input. If between 3 and 6, value does not change. Apply such kind of checks on any kind of value, when it makes sense.
    • You should also check if your szValue contains something and it's not empty:
      PHP Code:

      if(is_blank(szValue))
      {
           continue 


      Should be before if(g_eSettings[stgMsgEnable]).
    • Checking if sound/sprite exists before passing it to precache would be nice. Use file_exists for that.
    • In case of wrong configuration, make some logs to notify the user.
  • When replacing the old sounds/sprites you could unprecache the new ones(just a matter to hook FM_PrecacheModel for sprites and check the sprite name, for sounds hook FM_PrecacheSound). I assume you know default names for sounds & sprites.
  • In fwdSetModel, check if entity is valid before doing anything.
  • In grenade_throw check if user is alive before retrieving team.

OciXCrom 05-15-2016 14:33

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Checking if sound/sprite exists before passing it to precache would be nice. Use file_exists for that.
In case of wrong configuration, make some logs to notify the user.
I don't think that is necessary. It would be obvious if a file is missing. A message will show in the console if a sound is missing, and the server will automatically crash if the sprite is missing. In addition, file_exists checks in the cstrike folder, and people may use sounds from the valve folder.

Quote:

When replacing the old sounds/sprites you could unprecache the new ones(just a matter to hook FM_PrecacheModel for sprites and check the sprite name, for sounds hook FM_PrecacheSound). I assume you know default names for sounds & sprites.
I did it for the sound, but I'm not replacing any sprites.

Quote:

In grenade_throw check if user is alive before retrieving team.
Are you sure about this? What if the player dies in the exact moment when he is about to throw the grenade? What's the problem of getting the team of a dead player?

Everything else is fixed.

OciXCrom 05-20-2016 20:23

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Any updates about approval soon? Let me know if you have any suggestions.

HamletEagle 07-10-2016 13:50

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

I don't think that is necessary. It would be obvious if a file is missing. A message will show in the console if a sound is missing, and the server will automatically crash if the sprite is missing. In addition, file_exists checks in the cstrike folder, and people may use sounds from the valve folder.
There are ways to check valve folder too, IIRC by doing ../valve(in 1.8.3 a param was added for this), and the point was to avoid the crash and simply notice the owner that something in his configuration is wrong. Well, not really critical, just an ideea.

1.static in msgTextMsg, msgSendAudio is not needed.
2.
PHP Code:

return equal(szMessageg_szFireInTheHole) ? PLUGIN_HANDLED PLUGIN_CONTINUE 

? PLUGIN_HANDLED : PLUGIN_CONTINUE is not needed, simply return what equal give.
3.In fwdSetModel: default: return. Given the condition this can't ever by reached, can be removed.
4.
Quote:

Are you sure about this? What if the player dies in the exact moment when he is about to throw the grenade? What's the problem of getting the team of a dead player?
CSX fires grenade_throw forward from SetModel post, so after grenade is actually throw(SetModel being called at the end of the function which creates a grenade). Probably connected check is more proper than alive.
5.In grenade_throw:
  • Check if contain() != -1.
  • PHP Code:

    get_players(iPlayersiPnum

    skip bots, they don't need such information.
  • if(!is_blank(szSound)) is pointless, forward is called only for grenades so code reach a case for sure and string can't be empty.
6.In fwdPrecacheSound check if you should replace the sound before blocking the original one.
7.
PHP Code:

return szString[0] == EOS true false 

? true : false is not needed. Same for is_random
8.When reading the file, if it was empty, so plugin should not do anything pause it.

OciXCrom 07-11-2016 08:07

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

if(!is_blank(szSound)) is pointless, forward is called only for grenades so code reach a case for sure and string can't be empty.
It actually can be empty if you enable the sounds from the .ini file and leave a line empty for a certain grenade, which will block the "fire in the hole" sound for that grenade.

Quote:

In fwdPrecacheSound check if you should replace the sound before blocking the original one.
There's a check for that when registering the forward in plugin_init, so it won't be called unless the sound should be blocked.

PHP Code:

if(g_eSettings[stgSoundEnable] && ((!g_blSoundHe && !g_blSoundFlash && !g_blSoundSmoke) || !g_eSettings[stgSoundPlayType]))
        
register_forward(FM_PrecacheSound"fwdPrecacheSound"

Everything else is fixed.

HamletEagle 07-11-2016 10:05

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Glad to see you follow me, sometime I get bored when making reviews and I don't pay much attention.

Quote:

It actually can be empty if you enable the sounds from the .ini file and leave a line empty for a certain grenade, which will block the "fire in the hole" sound for that grenade.
PHP Code:

if(is_blank(szValue))
    continue 

You are checking if szValue is empty.

OciXCrom 07-11-2016 13:52

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
No, no. Let's say for example the user wants to block the "fire in the hole" sound for the HE grenade. He will leave the option SOUND_HE blank in the .ini file, so g_eSettings[stgSoundHe] will be empty, since no value is passed to it with or without the is_blank(szValue) check in fileRead(). Next, when grenade_throw() is called, the sound of the thrown grenade gets coppied into szSound, so if a HE grenade was thrown, szSound will be empty and if it was some other grenade - it won't be empty, so that's why that check is there - if it wasn't, the plugin will atempt to play a blank sound on the player(s).

Are you following? :D

MaXs 01-24-2017 10:31

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
so useful plugin.. bad

OciXCrom 01-24-2017 10:32

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Originally Posted by MaXs (Post 2489482)
so useful plugin.. bad

I'm glad that you find it useful. Thanks. :crab:

MaXs 01-24-2017 10:48

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
make better ones, not bad ones

OciXCrom 01-24-2017 13:09

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Originally Posted by MaXs (Post 2489491)
make better ones, not bad ones

Let me see you do something useful.

OciXCrom 02-02-2017 13:41

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Update v2.0 @ 02.02.2017

  • Added a section from which you can change the time it takes for a grenade to explode after it has been thrown.
  • Full code optimization.

khashayar007 11-27-2017 14:07

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Please fix this:

PHP Code:

crx_fireinthehole.sma(234 -- 235) : warning 213tag mismatch
crx_fireinthehole
.sma(236 -- 237) : warning 213tag mismatch
crx_fireinthehole
.sma(238 -- 239) : warning 213tag mismatch 


OciXCrom 11-27-2017 14:47

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
That's a problem from the compiler, not the plugin. It's fixed in AMXX 1.8.3. It doesn't bother the plugin in any way, so just ignore it, even though I just "fixed" it by adding useless symbols in the code.

karimoo97 05-18-2018 08:37

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Easily one of my favourite 10 plugins
Can you please add the ability to make the trail visible for team only?

Code:

[Trail = 1]

;Leaves a trail when you throw a grenade.

;<red> <green> <blue> -- Use "R" for a random color amount.



TRAIL_HE = 255 0 0

TRAIL_FLASH = 0 0 255

TRAIL_SMOKE = 0 255 0



TRAIL_SPRITE = sprites/smoke.spr

TRAIL_LIFE = 8

TRAIL_WIDTH = 5

TRAIL_TEAM = 1 // [0-SEE ALL, 1-TEAM ONLY, 2-YOU CAN SEE YOUR TRAIL ONLY]

TRAIL_BRIGHTNESS = 150


OciXCrom 05-18-2018 16:01

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Good idea, I'll try to add it as soon as I have a chance.

karimoo97 05-18-2018 16:43

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Originally Posted by OciXCrom (Post 2592711)
Good idea, I'll try to add it as soon as I have a chance.

Great ! I'll be waiting,good luck

OciXCrom 05-22-2018 13:14

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
https://img.shields.io/badge/update-...2018-green.svg
  • Added TRAIL_SHOW_TYPE setting that allows you to customize who can see the grenade trail.
  • Changed the .ini file style.
  • Added cromchat.

karimoo97 05-22-2018 23:22

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Originally Posted by OciXCrom (Post 2593350)
https://img.shields.io/badge/update-...2018-green.svg
  • Added TRAIL_SHOW_TYPE setting that allows you to customize who can see the grenade trail.
  • Changed the .ini file style.
  • Added cromchat.

Perfect ! I hope it gets approved

Thank you very much and keep up the good work

khashayar007 07-16-2018 05:22

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Add a feature that disable fire in the hole sound

OciXCrom 07-16-2018 08:22

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Originally Posted by khashayar007 (Post 2603952)
Add a feature that disable fire in the hole sound

It already has that feature. Just enable the [Sounds] category and leave all the sounds blank or set the SOUND_PLAY_TYPE setting to 0.

khashayar007 07-20-2018 07:13

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Quote:

Originally Posted by OciXCrom (Post 2603983)
It already has that feature. Just enable the [Sounds] category and leave all the sounds blank or set the SOUND_PLAY_TYPE setting to 0.

After doing this, sg_explode.wav sound sometimes play and sometimes not.

OciXCrom 07-20-2018 20:54

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
What did you write exactly?

khashayar007 07-21-2018 03:53

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
I just changed sounds to 1

PHP Code:

#===========================================================#
# Ultimate Fire in the Hole by OciXCrom: Configuration file #
#===========================================================#

# Settings are divided in categories. Each category has a number assigned to it.
# If the number is set to 0, the entire category will be disabled. 1 means it's enabled.

[Messages 1]
# The following 3 settings control how the chat message are going to look.
# Colors: &x01 (DEFAULT), &x03 (TEAM COLOR); &x04 (GREEN); &x05 (WHITE); &x06 (BLUE); &x07 (RED)
# Combining two or more team colors is NOT POSSIBLE in CS 1.6: &x03, &x05, &x06, &x07 - only ONE of these can be used inside a message.
# You can use $name$ and $team$ as placeholders.
MSG_HE = &x07$name$ &x01(RADIO): Fire in the hole! &x07[HE]
MSG_FLASH = &x05$name$ &x01(RADIO): Fire in the hole! &x05[FB]
MSG_SMOKE = &x04$name$ &x01(RADIO): Fire in the hole! &x04[SG]

# Who can see the grenade message?
# 0 = No messages.
# 1 = Only the player who threw the grenade.
# 2 = Only teammates.
# 3 = All players.
MSG_SHOW_TYPE 2

# Can admins see other team's messages if MSG_SHOW_TYPE = 2?
MSG_ADMIN_LISTEN 0

# Admin flag for the MSG_ADMIN_LISTEN setting.
MSG_ADMIN_FLAG e

# The team names when $team$ is used in a message.
MSG_TEAM_T T
MSG_TEAM_CT 
CT
MSG_TEAM_SPEC 
SPEC

[Sounds 1]
# Different sounds when you throw grenades.
# You can leave a sound blank if you want to remove that sound.

SOUND_HE 
SOUND_FLASH =
SOUND_SMOKE =

# Who can hear the grenade sound?
# 0 = No sounds.
# 1 = Only the player who threw the grenade.
# 2 = Only teammates.
# 3 = All players.
SOUND_PLAY_TYPE 0

[Trail 1]
# Leaves a trail when you throw a grenade.

# The following 3 settings control the trail color for each grenade.
# Format: <red> <green> <blue> -- You can use "R" for a random color amount (e.g. 255 R 255).
TRAIL_HE 255 0 0
TRAIL_FLASH 
255 255 255
TRAIL_SMOKE 
0 255 0

# The sprite that will be used for the trail.
TRAIL_SPRITE sprites/smoke.spr

# How long in before the trail completely disappears.
TRAIL_LIFE 10

# Trail width.
TRAIL_WIDTH 5

# Trail brightness (from 0 to 255).
TRAIL_BRIGHTNESS 200

# Who can see the trails?
# 0 = All players.
# 1 = Only the player who threw the grenade.
# 2 = Only teammates.
TRAIL_SHOW_TYPE 0

[Glow 0]
# This category makes the grenades glow when thrown.

# The following 3 settings control the glow color for each grenade.
# Format: <red> <green> <blue> -- You can use "R" for a random color amount (e.g. 255 R 255).
GLOW_HE 255 0 0
GLOW_FLASH 
255 255 255
GLOW_SMOKE 
0 255 0

# Glow brightness (from 0 to 255).
GLOW_BRIGHTNESS 125

# 0 = Transparent glow.
# 1 = Normal glow.
GLOW_TYPE 1

[Explode Time 0]
# Here you can change the explosion times for each grenade.

# The following 3 settings control the amount of seconds in which the grenade will explode after it has been thrown.
# For the smoke grenade, the seconds are counted after the grenade has stopped bouncing around.
EXPLODE_HE 5.0
EXPLODE_FLASH 
0.0
EXPLODE_SMOKE 
0.0 


OciXCrom 07-21-2018 15:19

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
sg_explode.wav has nothing to do with this plugin. That is the sound when the grenade explodes.

khashayar007 07-21-2018 16:24

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
but the problem occurs when sounds is 1 and when I change it to zero it the problem is gone

OciXCrom 07-21-2018 16:37

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
That makes no sense. The plugin isn't in any way messing with the sg_explode.wav sound.

khashayar007 07-22-2018 04:57

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Yeah it's strange. I have tested it a lot. Please test it.
I realized something. When I throw smoke in far distances it works fine but when I throw it near myself it has no sound.

OciXCrom 07-22-2018 08:03

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
Just tested it and it doesn't have any problems. You probably have some other plugin that's doing this.

PS: how can you even hear the sound if you throw the smoke far away?!

khashayar007 07-22-2018 09:11

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
I disabled all plugins and it still has that problem

OciXCrom 07-22-2018 10:20

Re: Ultimate Fire in the Hole [Messages|Grenade Trail|Grenade Glow|Sounds]
 
By all, you mean my plugin too?


All times are GMT -4. The time now is 07:01.

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