Raised This Month: $ Target: $400
 0% 

Returns from Fake Forwards


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-07-2009 , 18:14   Returns from Fake Forwards
Reply With Quote #1

How would I get the return value from a plugin that is using a fake forward that is executed by another plugin?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-07-2009 , 18:47   Re: Returns from Fake Forwards
Reply With Quote #2

Quote:
Originally Posted by Exolent[jNr] View Post
How would I get the return value from a plugin that is using a fake forward that is executed by another plugin?
You can use callfunc or create another forward/native that will send that return value.
This is how I would do at least and at the first thought ...
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 04-07-2009 at 18:52.
ot_207 is offline
Old 04-07-2009, 19:30
Dores
This message has been deleted by Dores. Reason: misunderstood the question...
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-07-2009 , 23:52   Re: Returns from Fake Forwards
Reply With Quote #4

You have plugin A sending fakeforward, plugin B using fakeforward, and you want plugin C to get what plugin B returned?
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-08-2009 , 15:41   Re: Returns from Fake Forwards
Reply With Quote #5

Quote:
Originally Posted by Emp` View Post
You have plugin A sending fakeforward, plugin B using fakeforward, and you want plugin C to get what plugin B returned?
No, I want plugin A to get what plugin B returned so I can check to see if "PLUGIN_HANDLED" or whatever returned.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-08-2009 , 16:26   Re: Returns from Fake Forwards
Reply With Quote #6

Code:
ExecuteForward( forward, return_value );
return_value should be what plugin B returned.

If you are using CreateMultiForward, you might want to check the second parameter in CreateMultiForward.
Code:
#define ET_IGNORE		0	//ignore return val
#define ET_STOP			1	//stop on PLUGIN_HANDLED
#define ET_STOP2		2	//same, except return biggest
#define ET_CONTINUE		3	//no stop, return biggest
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 04-08-2009 , 16:30   Re: Returns from Fake Forwards
Reply With Quote #7

PHP Code:
new fwAuth
public plugin_cfg()
{
   
fwAuth CreateMultiForward("user_auth"ET_STOPFP_CELL)
}

........
public 
client_authorized(id)
{
   new 
iReturn
   ExecuteForward
(fwAuthiReturnid)

  if (
iReturn == PLUGIN_HANDLED)
     
// Ugh
  
else
     
// OHHHHH

Like this?
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-08-2009 , 17:03   Re: Returns from Fake Forwards
Reply With Quote #8

Okay so I was trying some code for this:
Code:
#include <amxmodx> #include <amxmisc> new g_forward1; new g_forward2; public plugin_init() {     register_plugin("Forward Test Sender", "0.1", "Exolent");         register_clcmd("say /forward", "CmdForward"); } public plugin_natives() {     register_library("forward_test");         g_forward1 = CreateMultiForward("my_forward1", ET_IGNORE);     g_forward2 = CreateMultiForward("my_forward2", ET_STOP); } public CmdForward() {     new ret;     for( new i = 0; i < 5; i++ )     {         ExecuteForward(g_forward1, ret);         log_amx("Return1 [%i / 5]: %i", i + 1, ret);                 ExecuteForward(g_forward2, ret);         log_amx("Return2 [%i / 5]: %i", i + 1, ret);     } }
Code:
#include <amxmodx> #include <amxmisc> #if AMXX_VERSION_NUM >= 175     #pragma reqlib "forward_test"     #if !defined AMXMODX_NOAUTOLOAD         #pragma loadlib "forward_test"     #endif #else     #pragma library "forward_test" #endif forward my_forward1(); forward my_forward2(); public plugin_init() {     register_plugin("Forward Test Receiver", "0.1", "Exolent"); } public my_forward1() {     static count;     count++;     log_amx("Forward1: return %i;", count);     return count; } public my_forward2() {     static count;     count++;     log_amx("Forward2: return %i;", count);     return count; }
Here is the output in my console:
Code:
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return1 [1 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return2 [1 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return1 [2 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return2 [2 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return1 [3 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return2 [3 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return1 [4 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return2 [4 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return1 [5 / 5]: 0
L 04/08/2009 - 16:03:15: [forward_test_sender.amxx] Return2 [5 / 5]: 0
There are no logs from forward_test_receive.amxx

amxx plugins
Code:
 [ 28] Forward Test Sender     0.1         Exolent           forward_test_se  running  
 [ 29] Forward Test Receiver   0.1         Exolent           forward_test_re  running
So both are running, there are no errors in my console, and I'm using AMXX 1.8.1

Where is the problem?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-08-2009 , 18:54   Re: Returns from Fake Forwards
Reply With Quote #9

Print what g_forward1 and g_forward2 are. Also print what ExecuteForward returns.

Last edited by Emp`; 04-08-2009 at 18:57.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-08-2009 , 19:13   Re: Returns from Fake Forwards
Reply With Quote #10

Code:
#include <amxmodx> #include <amxmisc> new g_forward1; new g_forward2; public plugin_init() {     register_plugin("Forward Test Sender", "0.1", "Exolent");         register_clcmd("say /forward", "CmdForward"); } public plugin_natives() {     register_library("forward_test");         g_forward1 = CreateMultiForward("my_forward1", ET_IGNORE);     g_forward2 = CreateMultiForward("my_forward2", ET_STOP); } public CmdForward() {     log_amx("g_forward1 = %i", g_forward1);     log_amx("g_forward2 = %i", g_forward2);         static execute, ret;     for( new i = 0; i < 5; i++ )     {         execute = ExecuteForward(g_forward1, ret);         log_amx("Forward1 (#%i) (Execute: %i) (Return: %i)", i + 1, execute, ret);                 execute = ExecuteForward(g_forward2, ret);         log_amx("Forward2 (#%i) (Execute: %i) (Return: %i)", i + 1, execute, ret);     } }

Code:
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] g_forward1 = 0
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] g_forward2 = 2
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward1 (#1) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward2 (#1) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward1 (#2) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward2 (#2) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward1 (#3) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward2 (#3) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward1 (#4) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward2 (#4) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward1 (#5) (Execute: 1) (Return: 0)
L 04/08/2009 - 18:14:26: [forward_test_sender.amxx] Forward2 (#5) (Execute: 1) (Return: 0)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 02:20.


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