Raised This Month: $ Target: $400
 0% 

How to get return value of remote plugin func by pushing parameters?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
souvikdas95
Senior Member
Join Date: Mar 2012
Old 03-28-2014 , 06:28   How to get return value of remote plugin func by pushing parameters?
Reply With Quote #1

Suppose I have a function that returns a value ( integer ). How do I get the return value of the function based on the parameters I sent through callfunc_push_array or better than that if otherwise?

EDIT - The plugin is remote... The function is not declared in the same plugin. For your perusal, think about "get_score" function in amxmodx/data/csstats.amxx

Last edited by souvikdas95; 03-28-2014 at 06:30.
souvikdas95 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-28-2014 , 06:32   Re: How to get return value of remote plugin func by pushing parameters?
Reply With Quote #2

As I said to you before, use Dynamic Natives, don't use callfunc.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 03-28-2014 , 07:07   Re: How to get return value of remote plugin func by pushing parameters?
Reply With Quote #3

but then.. a prototype is necessary

You tell me a way I can call and get the return of the function "get_score" with fixed parameters stats[11] and bodyhits[8] without creating a separate native. No offence but i feel creating dynamic natives is stupid. it just makes it harder to determine where exactly it's used if not globally defined. for instance, think about dll natives. how am i supposed to differentiate which native was defined where?
So, instead of moving into the native level, I want to stick to function call.
In module CSX, it's done through this method only. It doesn't create a native but calls the function "get_score" of csstats.amxx to calculate score to determine ranks of players. If only that could be achieved by amx plugins. I hope you can understand what I am trying to say

Last edited by souvikdas95; 03-28-2014 at 07:08.
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-28-2014 , 08:05   Re: How to get return value of remote plugin func by pushing parameters?
Reply With Quote #4

Dynamic native should be fine. I'm not sure why you want to differentiate things. Just a matter to put the prototype in the target plugin, maybe adding some check if native exists. That's all.
Actually, I'm not sure what you're trying to achieve. Dynamic calculation or something ?
__________________

Last edited by Arkshine; 03-28-2014 at 08:09.
Arkshine is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 03-28-2014 , 08:21   Re: How to get return value of remote plugin func by pushing parameters?
Reply With Quote #5

Just like how csx module calculates the score by passing the required parameters and hence deriving function "get_score" from "csstats.amxx" ( without any native detection probably because it's known already what parameters need to be passed and the corresponding function ), I want an amx plugin to do the same.

Last edited by souvikdas95; 03-28-2014 at 08:22.
souvikdas95 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-28-2014 , 08:26   Re: How to get return value of remote plugin func by pushing parameters?
Reply With Quote #6

You don't really answer my question. While the current method is ugly, I would like to know what you're trying to achieve.
__________________
Arkshine is offline
souvikdas95
Senior Member
Join Date: Mar 2012
Old 03-28-2014 , 08:30   Re: How to get return value of remote plugin func by pushing parameters?
Reply With Quote #7

I am trying not to put external dependencies. ( natives in this case )

All it needs to do is load the calculator from the plugin. You can see loadcalc() and updatepos() functions in CSX module. These 2 manipulate the scoring algorithm.

Last edited by souvikdas95; 03-28-2014 at 08:44.
souvikdas95 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 05:57.


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