SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 23/02/2009, 04:26 PM   #1
D4rkBlade
Little Clucker
 
Join Date: Jan 2007
Posts: 11
Reputation: 1
Default AmxCallPublicGameMode & AmxCallPublicFilterScript

I found this functions looking the SDK script.

Code:
typedef int (*amxcallpublic_t)(char *szFunctionName);

amxcallpublic_t AmxCallPublicFilterScript;
amxcallpublic_t AmxCallPublicGameMode;
Are this functions usable? What they do?
D4rkBlade is offline   Reply With Quote
Old 23/02/2009, 08:44 PM   #2
mabako
Big Clucker
 
Join Date: Apr 2006
Posts: 112
Reputation: 3
Default Re: AmxCallPublicGameMode & AmxCallPublicFilterScript

Yes.

You need to initalize it at server-start though, for example:
Code:
AmxCallPublicFilterScript = (amxcallpublic_t)ppData[PLUGIN_DATA_CALLPUBLIC_FS];
AmxCallPublicGameMode = (amxcallpublic_t)ppData[PLUGIN_DATA_CALLPUBLIC_GM];
in the Load-function.

Notice just this thing: You can't pass any parameters as long as you do not have the AMX-pointers (and if you have them, you could use Amx_FincPublic/amx_Exec on your own as well). That's the main argument why this isn't practical to use, but if you do never pass parameters, you can of course use that. Since I personally have callbacks with parameters, I would not see why to use AmxCallPublicFilterScript/AmxCallPublicGameMode. For the fact I tested AmxCallPublicGameMode just right now on a 0.2X server and it appeared to work, and both returned addresses do point to functions, they should be useable.

AmxCallPublicFilterScript( char .. ) - calls that public function in all filterscripts
AmxCallPublicGameMode( char .. ) - calls that public function in the gamemode.
mabako is offline   Reply With Quote
Old 23/02/2009, 09:23 PM   #3
D4rkBlade
Little Clucker
 
Join Date: Jan 2007
Posts: 11
Reputation: 1
Default Re: AmxCallPublicGameMode & AmxCallPublicFilterScript

Yes, some time after this post I have tested the functions.
But anyway thanks mabako for the help, maybe it can be useful for other people
D4rkBlade is offline   Reply With Quote
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



All times are GMT. The time now is 08:54 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.