AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   CallFunc (https://forums.alliedmods.net/showthread.php?t=17889)

mysticssjgoku4 09-11-2005 03:54

CallFunc
 
Here's something I've been wondering. How is it possible to target something in another plugin with more than 1 thing needed.

like in HArbuRPAlpha.amxx
There is a code like
Code:
stock set_item_amount(id,func[],itemid,amount,table[],customid[]="")
Obviously it needs id, func, itemid, amount, table, customid.
Ok, How do I make it in callfunc, so that it targets all of these values needed from my plugin?

Here is my failed attempt.
Help?

Code:
callfunc_begin("set_item_amount","HarbuRPAlpha.amxx") callfunc_push_int(id,"+",411,1,"money") callfunc_end()


Ty.

Greenberet 09-11-2005 05:02

Code:
callfunc_begin("set_item_amount","HarbuRPAlpha.amxx") callfunc_push_int( id ) callfunc_push_str( "+" ) callfunc_push_int( 411 ) callfunc_push_int( 1 ) callfunc_push_str( "money" ) callfunc_end()

this would be the right one.
but you want to call a stock, and you can't call a stock outside of the plugin.
If you want to call a function in a plugin then the function has to be marked as "public"

Johnny got his gun 09-11-2005 05:17

Or better yet try out the register_native feature.

Greenberet 09-11-2005 09:01

register_native is only usefull if you want to call a function that is declared in ONE plugin. But with callfunc you can call the same function in each plugin.

mysticssjgoku4 09-12-2005 01:09

I just made a new script inside the HArbuRPAlpha

Code:
public gitems(id,itemid) {           set_item_amount(id,"+",itemid,1,"money")           return PLUGIN_HANDLED }

Thank you very much for your help on that :D

Freecode 09-12-2005 03:48

Quote:

Originally Posted by Greenberet
register_native is only usefull if you want to call a function that is declared in ONE plugin. But with callfunc you can call the same function in each plugin.

only if u made sense.........

BAILOPAN 09-12-2005 03:51

Quote:

Originally Posted by Freecode
Quote:

Originally Posted by Greenberet
register_native is only usefull if you want to call a function that is declared in ONE plugin. But with callfunc you can call the same function in each plugin.

only if u made sense.........

their purposes are different. you use register_native to let many plugins call your own function. however, you use callfunc to call many functions from your plugin.

Freecode 09-12-2005 03:53

thats better 8)

mysticssjgoku4 09-12-2005 09:51

So, basically register_native is the opposite command of callfunc then, correct?


All times are GMT -4. The time now is 14:32.

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