Raised This Month: $ Target: $400
 0% 

creating forwards in plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 10-27-2006 , 01:45   creating forwards in plugins
Reply With Quote #1

Let's say I have this function in a script:
Code:
public give_xp(id,amount,type,reason[]) {     xp[id][type] += amount     client_print(id,print_chat,"[AMXX] You have been given %d %s XP points for %s",amount,typestringconst[type],reason) }

Now that code is in plugin A. I want it so that someone can come along and make a plugin B and just hook when plugin A calls that function and be able to know what the parameters are.

Code:
_

Last edited by GHW_Chronic; 10-27-2006 at 01:58.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 10-27-2006 , 01:58   Re: creating forwards in plugins
Reply With Quote #2

Code:
#include <amxmodx> new fwd_give_xp = -1; public plugin_init() {     fwd_give_xp = CreateMultiForward("give_xp", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_STRING);     register_clcmd("say /forward", "cmdForward"); } public cmdForward(id) {     if(fwd_give_xp > -1)     {         new fwd_result;         ExecuteForward(fwd_give_xp, fwd_result, id, 100, 1, "ZOMG");     }     return PLUGIN_HANDLED; } public give_xp(id, amount, type, reason[]) {     client_print(id, print_chat, "%i %i %i %s", id, amount, type, reason); }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-27-2006 , 02:02   Re: creating forwards in plugins
Reply With Quote #3

wow this is sweaty.. so we are able to know when is a function called in other plugin if they have a multiforward? and those this goes for functions only? or stocks too..
k007 is offline
Send a message via MSN to k007
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 10-27-2006 , 02:02   Re: creating forwards in plugins
Reply With Quote #4

wow, thats so simple. that's f***ing awesome. thanks bro
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 10-27-2006 , 02:04   Re: creating forwards in plugins
Reply With Quote #5

Quote:
Originally Posted by k007 View Post
wow this is sweaty.. so we are able to know when is a function called in other plugin if they have a multiforward? and those this goes for functions only? or stocks too..
i don't think you know what a stock is.
this:
allows a plugin creator to allow other plugin creators to create functions that are called whenever their function is called.

edit:
i don't think you know exactly what a function is either.

"set_user_name" is a native function, and when you put:
"public blah()" in a plugin, blah is now a function you made. (of course it doesn't need to be public to be a function)

Last edited by GHW_Chronic; 10-27-2006 at 02:06.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-27-2006 , 02:11   Re: creating forwards in plugins
Reply With Quote #6

so a stock counts as a function?
k007 is offline
Send a message via MSN to k007
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 10-27-2006 , 02:18   Re: creating forwards in plugins
Reply With Quote #7

It has to be a public function.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 10-27-2006 , 02:31   Re: creating forwards in plugins
Reply With Quote #8

Quote:
Originally Posted by k007 View Post
so a stock counts as a function?
a stock doesn't count as a function. read up on what a stock is.

and i guessed it had to be public to use this forwarding, what i was stating was that a function does not have to be public to be a function in general.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 10-27-2006 , 04:08   Re: creating forwards in plugins
Reply With Quote #9

Quote:
Originally Posted by GHW_Chronic View Post
a stock doesn't count as a function. read up on what a stock is.

and i guessed it had to be public to use this forwarding, what i was stating was that a function does not have to be public to be a function in general.
a stock is a function.
it will just be only created when it is used.
and you can create forwards in any type of function.
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
VEN
Veteran Member
Join Date: Jan 2005
Old 10-27-2006 , 05:44   Re: creating forwards in plugins
Reply With Quote #10

Quote:
Originally Posted by Greenberet View Post
a stock is a function.
AFAIR, a stock is an "attribute", it can be used not only for functions but for example for constant as well.
VEN 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 04:50.


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