Raised This Month: $51 Target: $400
 12% 

CreateMultiForward not returning '< 0' on error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-03-2006 , 08:01   CreateMultiForward not returning '< 0' on error
Reply With Quote #1

I'm making a forward to transport some stats information from the war3ft plugin to my plugin that connects to a remote MySQL server.

Now I'm making a forward in plugin_init().
I want it to give an error message on failure:

Code:
//This is in plugin_init() //The g_ vars are declared outside code #if CROSSPLUGIN_STATS         //Params: authid, weaponid, weaponname, kills, deaths, headshots, shots, hits     g_statsPluginForward = CreateMultiForward("nonexistingblablafunction", ET_IGNORE, FP_STRING, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL);         log_amx("Loaded Forward: %d", g_statsPluginForward);         //Log error to amx logfile on fail     if(g_statsPluginForward <= 0)         log_amx("Could not find any plugin to send war3ft stats data to."); #endif

The output this gives in the amxmodx logfiles is:

Loaded Forward: 63

---

How can this be? I clearly forwarded it to a function that doesn't exist, and still it gives me a positive number.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-03-2006 , 09:53   Re: CreateMultiForward not returning '< 0' on error
Reply With Quote #2

First of all, you're doing a Multi forward, meaning it'll send it to ALL plugins. Theoretically, this type of forward cannot fail unless the AMXX core fucks up. With CreateOneForward, if you create a forward to a function in a plugin that doesn't exist (or execute it), it should fail.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-03-2006 , 10:24   Re: CreateMultiForward not returning '< 0' on error
Reply With Quote #3

Okay, I'll just have to make a dummy function in each plugin that wants to use the war3ft stats.
Then I'll check in war3ft's plugin_init () if it's possible to do a ExecuteForward() to the dummy function.
If unsuccessfull, don't use crossplugin_stats.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-03-2006 , 10:27   Re: CreateMultiForward not returning '< 0' on error
Reply With Quote #4

Quote:
Originally Posted by MaximusBrood View Post
Okay, I'll just have to make a dummy function in each plugin that wants to use the war3ft stats.
Then I'll check in war3ft's plugin_init () if it's possible to do a ExecuteForward() to the dummy function.
If unsuccessfull, don't use crossplugin_stats.
Terrible. Use a native that registers a hook to the cross stats function, then loop through each one and CreateOneForward -> ExecuteForward on it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-03-2006 , 10:28   Re: CreateMultiForward not returning '< 0' on error
Reply With Quote #5

Quote:
Originally Posted by Hawk552 View Post
Use a native that registers a hook to the cross stats function
Which native would that be then?
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-03-2006 , 10:33   Re: CreateMultiForward not returning '< 0' on error
Reply With Quote #6

Quote:
Originally Posted by MaximusBrood View Post
Which native would that be then?
No, my point is that you make one.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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:32.


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