Raised This Month: $ Target: $400
 0% 

Returns from Fake Forwards


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 04-08-2009 , 23:37   Re: Returns from Fake Forwards
Reply With Quote #1

Instead of using ET_STOP try using ET_STOP2 or ET_CONTINUE here
__________________
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-10-2009 , 15:33   Re: Returns from Fake Forwards
Reply With Quote #2

It turns out that callfunc_* functions are the only solution to this.

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Forward Test Sender", "0.1", "Exolent");         register_clcmd("say /forward", "CmdForward"); } public CmdForward() {     static funcid, plugin_name[64], retval;     new plugins = get_pluginsnum();     for( new i = 0; i < plugins; i++ )     {         funcid = get_func_id("my_forward", i);         if( funcid == -1 ) continue;                 callfunc_begin_i(funcid, i);         retval = callfunc_end();                 get_plugin(i, _, _, plugin_name, sizeof(plugin_name) - 1);                 log_amx("Plugin: %s -- Return: %i", plugin_name, retval);     } }

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Forward Test Receiver", "0.1", "Exolent"); } public my_forward() {     static count;     count++;     log_amx("Forward: return %i;", count);     return count; }

Code:
L 04/10/2009 - 14:06:29: [forward_test_receive.amxx] Forward: return 1;
L 04/10/2009 - 14:06:29: [forward_test_sender.amxx] Plugin: Forward Test Receiver -- Return: 1
Thanks to everyone who helped!
__________________
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-10-2009 , 17:20   Re: Returns from Fake Forwards
Reply With Quote #3

Exolent (or someone else) would you mind getting a profile on the difference between ExecuteForward and callfunc_* (preferably for ~3 parameters)
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`
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 04-11-2009 , 01:12   Re: Returns from Fake Forwards
Reply With Quote #4

natives get created in plugin_natives() not forwards...

create the forwards in plugin_init()

Using your first example:
Code:
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward1: return 1;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return1 [1 / 5]: 0
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward2: return 1;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return2 [1 / 5]: 1
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward1: return 2;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return1 [2 / 5]: 0
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward2: return 2;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return2 [2 / 5]: 2
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward1: return 3;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return1 [3 / 5]: 0
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward2: return 3;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return2 [3 / 5]: 3
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward1: return 4;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return1 [4 / 5]: 0
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward2: return 4;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return2 [4 / 5]: 4
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward1: return 5;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return1 [5 / 5]: 0
L 04/10/2009 - 22:11:04: [forward_test_recieve.amxx] Forward2: return 5;
L 04/10/2009 - 22:11:04: [forward_test_send.amxx] Return2 [5 / 5]: 5;
It should have been your clue something was wrong when you never logged anything in the return sma... meaning it wasnt being run.


changed it like 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");     g_forward1 = CreateMultiForward("my_forward1", ET_IGNORE);     g_forward2 = CreateMultiForward("my_forward2", ET_STOP); } public plugin_natives() {     register_library("forward_test"); } 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);     } }

It should also be noted that callfunc natives are considered deprecated.

-------------
Oh and Emp`, from the man himself. Basically difference is probably negligible.

Last edited by vittu; 04-11-2009 at 01:34.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-11-2009 , 01:31   Re: Returns from Fake Forwards
Reply With Quote #5

Wow, I can't believe I overlooked that. Thanks.
__________________
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