Raised This Month: $ Target: $400
 0% 

env_beam fires HookSingleEntityOutput callback only once


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 02-14-2016 , 20:28   env_beam fires HookSingleEntityOutput callback only once
Reply With Quote #1

So basiclly, my problem is that the callback in this code is only fired once. I need it to be called for every frame for every touch in order to play a sound when a player touches the 'beam'.
PHP Code:
HookSingleEntityOutput(iEnt"OnTouchedByEntity"MineLaser_OnTouchfalse); 
Think code from [Here]
SDK env_beam think code


As you can see, the part that messes up with the (next) think is this
Code:
        if( tr.fraction != 1.0 && PassesTouchFilters( tr.m_pEnt ) ) 
        { 
            m_OnTouchedByEntity.FireOutput( tr.m_pEnt, this, 0 ); 
            return; 
        }
Things I have tried:
I have tried to set the next think time using the following code:
PHP Code:
SetEntProp(iEntProp_Data"m_nNextThinkTick"GetGameTickCount()); 
I have also tried to reassign the TouchType value using DispatchKeyValue in MineLaser_OnTouch, but with no luck.

My plugin's code in case you're intrested


Any ideas?
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 02-14-2016 at 20:33. Reason: Accidently posted before completing the formatting.. :/
pokemonmaster is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-15-2016 , 15:35   Re: env_beam fires HookSingleEntityOutput callback only once
Reply With Quote #2

Use SDKHooks' touch hooks rather than the outputs.
__________________
asherkin is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 02-16-2016 , 04:15   Re: env_beam fires HookSingleEntityOutput callback only once
Reply With Quote #3

Or toggle the entity at the start of your MineLaser_OnTouch callback.
PHP Code:
AcceptEntityInput(caller"TurnOff");
AcceptEntityInput(caller"TurnOn"); 
This sets the next think correctly again.
__________________
Peace-Maker is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 02-16-2016 , 22:08   Re: env_beam fires HookSingleEntityOutput callback only once
Reply With Quote #4

Quote:
Originally Posted by asherkin View Post
Use SDKHooks' touch hooks rather than the outputs.
For some reason, I the callback is not even fired.
This is what I have tried:
PHP Code:
SDKHook(ent_laserSDKHook_TouchSDKCallback_TouchPost);

public 
void SDKCallback_TouchPost(int iEntint iOtherEnt)
{
     
// Nothing printed in server console
     
PrintToServer("Callback called");

Quote:
Originally Posted by Peace-Maker View Post
Or toggle the entity at the start of your MineLaser_OnTouch callback.
PHP Code:
AcceptEntityInput(caller"TurnOff");
AcceptEntityInput(caller"TurnOn"); 
This sets the next think correctly again.
This has actually worked. Thanks for the help
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 02-16-2016 at 22:10.
pokemonmaster 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 00:56.


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