AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to get return value of remote plugin func by pushing parameters? (https://forums.alliedmods.net/showthread.php?t=237666)

souvikdas95 03-28-2014 06:28

How to get return value of remote plugin func by pushing parameters?
 
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

hornet 03-28-2014 06:32

Re: How to get return value of remote plugin func by pushing parameters?
 
As I said to you before, use Dynamic Natives, don't use callfunc.

souvikdas95 03-28-2014 07:07

Re: How to get return value of remote plugin func by pushing parameters?
 
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

Arkshine 03-28-2014 08:05

Re: How to get return value of remote plugin func by pushing parameters?
 
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 ?

souvikdas95 03-28-2014 08:21

Re: How to get return value of remote plugin func by pushing parameters?
 
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.

Arkshine 03-28-2014 08:26

Re: How to get return value of remote plugin func by pushing parameters?
 
You don't really answer my question. While the current method is ugly, I would like to know what you're trying to achieve.

souvikdas95 03-28-2014 08:30

Re: How to get return value of remote plugin func by pushing parameters?
 
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.


All times are GMT -4. The time now is 05:57.

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