Raised This Month: $ Target: $400
 0% 

forward_return questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Silencer123
Veteran Member
Join Date: Jul 2006
Old 06-01-2009 , 15:27   forward_return questions
Reply With Quote #1

Some forwards - many forwards - deliver many parameters. E.g.:
Code:
FM_EmitSound void (ent, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch)
Now, I know how to change one single parameter using forward_return, but how would I
go about changing all the parameters in a function/method called by register_forward?

Like this?
Code:
public method(int, Float:flt, const string[]) {      forward_return(FMV_CELL, new_int, FMV_FLOAT, new_flt, FMV_STRING, new_string);      return FMRES_SUPERCEDE;  }


Or like this?
Code:
public method(int, Float:flt, const string[]) {       forward_return(FMV_CELL, new_int);      forward_return(FMV_FLOAT, new_flt);      forward_return(FMV_STRING, new_string);      return FMRES_SUPERCEDE;   }

Or some way completely different?

Then, what exactly is "FMV_CELL"? As far as I know there are only
FMV_CELL, FMV_FLOAT and FMV_STRING, so FMV_CELL would be for
integers, wouldn't it?

Then, what about arrayed floats like origin[3], velocity[3], vector[3] and angles[3]?

Then, as const string[] is given as a constant, can it even be changed
by forward_return?

Also, can a forward be executed via ExecuteForward while a forward is "in progress",
as in, from within a to a forward hooked method?
__________________
EAT YOUR VEGGIES
Silencer123 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-01-2009 , 15:32   Re: forward_return questions
Reply With Quote #2

There is nothing to return, and you can't set params on the fly as you would do with ham.
Just send the equivalent EngFunc_XX, or emit_sound (better), with params you want, and return FMRES_SUPERCEDE.

Use forward_return when the forward returns something (aka you see other thing than void before the EngFunc

Code:
EngFunc_EmitSound,					// void )			(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);


EngFunc_PointContents,				// int  )			(const float *rgflVector);
Registering FM_PointContents, you could use forward_return.
In that case you would use FMV_CELL because the return value is an int.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 06-01-2009 , 17:55   Re: forward_return questions
Reply With Quote #3

Holy shit thank you so much. Works perfectly now.
Understood completely wrong what forward_return did.
Thought it alters parameters, but in fact it alters the return value.
So it is not possible to on-the-fly-change a forward's parameters?
That somehow sucks, but thank god it is possible in ham sandwich module.
I'd give you karma, but wow the system was removed? Too many flipping
idiots begging for it? Oh well, thanks either way - it's the thought that counts. =)
__________________
EAT YOUR VEGGIES
Silencer123 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 18:41.


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