AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   plugin pause quest. (https://forums.alliedmods.net/showthread.php?t=55795)

kmal2t 05-29-2007 20:29

plugin pause quest.
 
How would I get a plugin to pause itself effectively? I know there are the functions pause, unpause, plugin_pause, and plugin_unpause but it's worthless because if the plugin is renamed it won't pause itself. Is there a way to have the plugin find its own directory and name so I can make that the variable for the second parameter in pause(<flags>, <plugin>)?

slmclarengt 05-30-2007 17:16

Re: plugin pause quest.
 
Well if I'm thinking what you're thinking (a plugin that ONLY you can use and anyone who changes the name to avoid being caught with taking it), you could do something like create a FCVAR_SERVER CVAR so that it can be obtained by checking if that cvar is running, then somehow find the name of the plugin by parsing the data returned by maybe an "amxx cvars" like call.

There is probably a better, more effective and less kryptic way, but that's just my two cents :-).

Slmclarengt

kmal2t 05-30-2007 19:11

Re: plugin pause quest.
 
Actually that isn't the idea. I don't care if they rename it considering my name will always be in the register Title and Author. I just want to have it so:

if(conditions not met) { plugin pauses itself by getting its own name then pausing itself OR

if(conditions not met) { ignore all the rest of the plugin after this }

slmclarengt 05-30-2007 19:16

Re: plugin pause quest.
 
Well I believe you can do:

Code:
public plugin_init() {      if (conditions not met)              return PLUGIN_CONTINUE      else      {            register_plugin(etc...)      } }

Slmclarengt

_Master_ 05-30-2007 19:56

Re: plugin pause quest.
 
register_plugin() can safely be left out of any plugin without altering functionality. Just by not calling it will NOT stop the plugin.

kmal2t 05-31-2007 02:50

Re: plugin pause quest.
 
I think with that double negative you're saying his method won't work. Anyone have a feasible method?

_Master_ 05-31-2007 04:47

Re: plugin pause quest.
 
Depending on your conditions to be met, you could try this in plugin_precache()
Code:

pause("ade")

kmal2t 05-31-2007 19:39

Re: plugin pause quest.
 
That's a really good idea, it works. Ok, now my question is, how would could I get a server's own ip address?

_Master_ 06-01-2007 01:54

Re: plugin pause quest.
 
Not sure of it but try
PHP Code:

static ip[16

PHP Code:

get_user_ip(0ip151


kmal2t 06-04-2007 15:05

Re: plugin pause quest.
 
Just gave this a try and it works, thanks.


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

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