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

Spray bug fix


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Gameplay        Approver:   ConnorMcLeod (74)
Simo123
Junior Member
Join Date: Feb 2009
Old 03-01-2012 , 11:26   Spray bug fix
Reply With Quote #1

Description
This plugin fixes spray/impulse 201 sound bug, when you're under for ex. an train on de_train map you couldn't hear the sound of your own spray or others. Fixes also a bug when you spray at a certain distance and the decal is not displayed.

Modules
-amxmodx
-fakemeta

Credits
Arkshine - A method that fixes decal at certain distance and sound bug.

Other info
It should work on other mods as well.

I made a fast video where the spray sound bug is shown,
(with and without fix).
http://youtu.be/gj-fFqi9oAo

Updated the plugin - 1.0 -> 1.1.
Fixes now decal distance bug
Spray sound bug fix -> Spray bug fix
Other method to fix those bugs

Tested with amxmodx 1.8.1 in Counter-Strike 1.6.
Attached Files
File Type: sma Get Plugin or Get Source (spray_bug_fix.sma - 2202 views - 789 Bytes)

Last edited by Simo123; 03-02-2012 at 16:48. Reason: 1.0 -> 1.1
Simo123 is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 03-01-2012 , 16:43   Re: Spray sound bug fix
Reply With Quote #2

afaik in linux servers that spray event won't work, try it and you will see , anyway using spk to only that client is bad and is useless...the sprayer sound is emited not spoken in players console
__________________

Last edited by tuty; 03-01-2012 at 16:43.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-01-2012 , 16:59   Re: Spray sound bug fix
Reply With Quote #3

Real fix would prevent the sound from playing only when the spray is not done and would prevent private data (next decal time) from being set.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Simo123
Junior Member
Join Date: Feb 2009
Old 03-01-2012 , 17:17   Re: Spray sound bug fix
Reply With Quote #4

I can't find any other way, client_cmd is just like you would write it in your console, I wouldn't say it would harm anyone, and no it didn't work with emitsound, I don't know any other way since I don't know what is causing it, if it's entities or what it is.

Also sound is working properly, you can hear it and others can do so, imo it's good as it is. Ofc if anyone is coming up with a better idea which may work, feel free to post it here then.

EDIT: The plugin worked fine on my linux server tuty.

Last edited by Simo123; 03-01-2012 at 17:26.
Simo123 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-01-2012 , 17:22   Re: Spray sound bug fix
Reply With Quote #5

Quote:
Originally Posted by Simo123 View Post
I can't find any other way, client_cmd is just like you would write it in your console, I wouldn't say it would harm anyone, and no it didn't work with emitsound, I don't know any other way since I don't know what is causing it, if it's entities or what it is.

Also sound is working properly, you can hear it and others can do so, imo it's good as it is. Ofc if anyone is coming up with a better idea which may work, feel free to post it here then.
But all players hear it, whatever the place they are on the map lol.

Well, from your event you could retrieve player index using read_data(2) and then emit sound from that player (no index is passed to the event, so id you use is equal to 0).
This won't fix the wrong pdata though.
edit : misread, i thought about another bug.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-01-2012 at 17:35.
ConnorMcLeod is offline
Old 03-01-2012, 17:30
Devil259
This message has been deleted by ConnorMcLeod. Reason: useless comment
Simo123
Junior Member
Join Date: Feb 2009
Old 03-01-2012 , 17:44   Re: Spray sound bug fix
Reply With Quote #6

The thing is, I guess there isn't any better solution though now atm. Anyway I will look into this really fast as soon as I can, I got it working with read_data(2), the only problem was that it did the sound only for yourself, but I didn't even try with emit_sound, so I will look into it.

EDIT: Failed with the text, obv it would just make the sound "only" for you, anyways new update coming.

Last edited by Simo123; 03-01-2012 at 17:49.
Simo123 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-01-2012 , 17:48   Re: Spray sound bug fix
Reply With Quote #7

I would do it like this :

Declare a Float global array, 33 cells, to store when a sound was played for a player.
When emitsound is sent, with the correct sound, retrieve the entity owner, it is the player id, store the gametime in the global array.
When the even is called, check that time, if it is more than 0.1 for actual gametime, send your emit_sound.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Simo123
Junior Member
Join Date: Feb 2009
Old 03-01-2012 , 22:01   Re: Spray sound bug fix
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
I would do it like this :

Declare a Float global array, 33 cells, to store when a sound was played for a player.
When emitsound is sent, with the correct sound, retrieve the entity owner, it is the player id, store the gametime in the global array.
When the even is called, check that time, if it is more than 0.1 for actual gametime, send your emit_sound.
Tested, it didn't work. As I got it now it seems as client_cmd only can only get the real sound, also with impulse 201 sound remake plugins it wouldn't fix the bug cause it uses the emit_sound function.

It seems as it would require to do a own distance check between the impulse 201 sounds, since read_data(2) did not work well, it was just for your own "id" and that isn't properly if we compare it to as how the standard impulse 201 sound is, it should be played to all but at a certain distance of couse.
Simo123 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-02-2012 , 06:56   Re: Spray sound bug fix
Reply With Quote #9

There are actually 2 bugs you can easily solved because of one line.
The spray works like that :

1) Throw a traceline and see if we can paint a decal.
Spoiler
2) If we can, an "ultra temporary SprayCan entity" is spawned and is set with the player's origin/angles.
Spoiler
3) 0.1 second later, before painting the decal it checks again if we can with a traceline :
Spoiler
The 2 bugs happen because of 2) on the first line, where the entity origin is set with the player's origin + 32 on z axis. And the problem is +32.

- The first bug : When you try to spray at the distance limit you won't see decal. It's because the first traceline was ok with origin + pev->viewofs (+17 on z) but the second traceline has failed because of the start origin is not the same (+32 on z).
- The second bug : When you try to spray below something, sometimes you won't hear the sound. It's because the entity origin starts in a non-open area, meaning starts inside something.

To solve these issues, you would use pev->view_ofs (+17) instead of +32.

Code:
#include <amxmodx> #include <fakemeta> public plugin_init( ) {     register_forward( FM_EmitSound, "OnEmitSound" ); } public OnEmitSound( const entity, const channel, const sound[ ] ) {     static const spraySound[] = "player/sprayer.wav";     if( equal( sound, spraySound, charsmax( spraySound ) ) )     {         new player = pev( entity, pev_owner );         new Float:origin[3];         new Float:viewOfs[3];                 pev( player, pev_origin, origin );         pev( player, pev_view_ofs, viewOfs );                 origin[0] += viewOfs[0];         origin[1] += viewOfs[1];         origin[2] += viewOfs[2];         set_pev( entity, pev_origin, origin );     } }
__________________
Arkshine is offline
tpt
Member
Join Date: Jun 2009
Location: Scripting help section
Old 03-02-2012 , 06:58   Re: Spray sound bug fix
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
I would do it like this :

Declare a Float global array, 33 cells, to store when a sound was played for a player.
When emitsound is sent, with the correct sound, retrieve the entity owner, it is the player id, store the gametime in the global array.
When the even is called, check that time, if it is more than 0.1 for actual gametime, send your emit_sound.
Quote:
Originally Posted by Simo123 View Post
Tested, it didn't work. As I got it now it seems as client_cmd only can only get the real sound, also with impulse 201 sound remake plugins it wouldn't fix the bug cause it uses the emit_sound function.

It seems as it would require to do a own distance check between the impulse 201 sounds, since read_data(2) did not work well, it was just for your own "id" and that isn't properly if we compare it to as how the standard impulse 201 sound is, it should be played to all but at a certain distance of couse.
Tested and works fine...



edit: It doesn't matter anyway since Arkshine has better way to fix this.

Last edited by tpt; 03-02-2012 at 07:01.
tpt 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 17:52.


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