Raised This Month: $32 Target: $400
 8% 

How To: Add callbacks without a module.


Post New Thread Reply   
 
Thread Tools Display Modes
LynX
Veteran Member
Join Date: Oct 2004
Old 03-28-2005 , 02:56  
Reply With Quote #11

Omg, using mine retarted topic v3x
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-28-2005 , 10:51  
Reply With Quote #12

XD
It was a joke. Not a very good one, but I thought it was funny.

Anyway...enjoy the tutorial! I'm sure one of you must find some use out of it.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
BAILOPAN
Join Date: Jan 2004
Old 03-28-2005 , 11:17  
Reply With Quote #13

This is a terrible way to do callbacks, we made the callfunc natives so people wouldn't do things like this!!!!11111 ;]

http://www.amxmodx.org/funcwiki.php?...func&go=search
__________________
egg
BAILOPAN is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-28-2005 , 13:04  
Reply With Quote #14

Actually BAILOPAN, there is a VERY specific reason I did not do it that way.

You could make a very simple function to make a callback using the callfunc functions:

Code:
new send_callback(function[]) {     new funcid = funcidx ( function )     callfunc_begin_i(funcid)     callfunc_end()     while(funcid)     { etc etc

Just like finding all of the entities in a map and removing them.

HOWEVER, what if you want to make a callback that is NOT plugin specific? the callfunc_begin_i forces you to put in a plugin name, or its just done in the calling plugin!

That wont do for what I wanted to do, which is allow people to plugin in new modules and receive the callback if they like. I'd have to hardcode every plugin I want to call into the callback function!

In addition, I want the callback to obey the sequence of plugins. When you send a server command, it goes through each plugin in sequence, unless I am wrong. Which means you can block it, thus adding or removing functionality. I like to use my method as sort of a callback to make sure all plugins send the hud_message adding in sequence, so it doesnt screw up.

So your method does not work for what I want, which is a true callback like toucher from engine, in which you can block it and such, and it goes to any plugin trying to catch it, no hard coding needed.

You should ADD a function that calls the function in all of the plugins, so its plugin inspecific. That would actually be useful for what I need it to do.

Until then, this method is useful.

If I didn't say it before, I could be wrong, and the function I need is hiding somewhere. I did look around, but maybe I'm just not seeing it.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-19-2005 , 09:51  
Reply With Quote #15

I came up with a better way to do it!
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-19-2005 , 16:54  
Reply With Quote #16

Quote:
Originally Posted by Twilight Suzuka
I came up with a better way to do it!
Then tell us or don't post at all!! :-)
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 04-19-2005 , 17:04  
Reply With Quote #17

make things like this sticky
__________________
- Bye bye!
nightscreem is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-19-2005 , 22:48  
Reply With Quote #18

Code:
public send_callback(function[])
{
	for(new i = 0; i < get_pluginsnum(); i++)
	{
		new filename[100],other[100]
		get_plugin ( i,filename,99,other,99,other,99,other,99,other,99 )

		new check = callfunc_begin ( function, filename )
		if(check > 0)
		{
			new block = callfunc_end ( )

			if(block == PLUGIN_HANDLED) return;
		}
	}
	return;
}
As you can see, this will call the plugin in ALL plugins, and block it if the plugin wants.

It is faster, but less effecient the the server command callback.
You can easily add parameters to it as well, as many as you like.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
cTn
Senior Member
Join Date: Oct 2005
Old 11-01-2005 , 05:04  
Reply With Quote #19

Code:
case 1: {
	give_item( id, "weapon_ak47" )
	give_item( id, "weapon_ak47" ) 
	give_item( id, "weapon_ak47" ) 
	set_hudmessage(100, 200, 0, 0.03, 0.24, 0, 0.0, 0.0, 4.0, 10.0,1)
	show_hudmessage(id,"cTn stuff: Gived AK47") 
	console_cmd( id, "amx_ctnstuff" )
	return PLUGIN_HANDLED 
         }
this is defintion for m menu .... how to let menu opened without

console_cmd( id, "amx_ctnstuff" ) ??
__________________
cTn is offline
Send a message via ICQ to cTn Send a message via MSN to cTn
Old 06-27-2006, 18:43
Martin1
This message has been deleted by BAILOPAN. Reason: off topic, first warning
Old 10-11-2007, 18:36
Podunk
This message has been deleted by Emp`. Reason: look at the dates.
Reply


Thread Tools
Display Modes

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 15:09.


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