Raised This Month: $51 Target: $400
 12% 

safemode


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Technical/Development       
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-28-2023 , 19:27   safemode
Reply With Quote #1



Safemode loads server without Amxx on select maps.

HOW TO USE:
First backup plugins.ini as plugins.ini.backup. Make safe_mode.ini and add maps.
Quote:
.
├── amxmodx
│ ├── ACKNOWLEDGEMENTS.txt
│ ├── configs
│ │ ├── amxx.cfg
│ │ ├── clcmds.ini
│ │ ├── cmds.ini
│ │ ├── configs.ini
│ │ ├── core.ini
│ │ ├── custommenuitems.cfg
│ │ ├── cvars.ini
│ │ ├── maps.ini
│ │ ├── miscstats.ini
│ │ ├── modules.ini
│ │ ├── plugins.ini
│ │ ├── plugins.ini.backup
│ │ ├── safe_mode.ini
│ │ ├── speech.ini
│ │ ├── sql.cfg
│ │ └── users.ini
Example safe_mode.ini.
Code:
//Optionally add up to 24 plugins on top line. Use Map_Specific_Plugins as needed.
"op4ctf_chasm" "plugin1.amxx" "plugin2.amxx" "plugin3.amxx" "plugin4.amxx" "plugin5.amxx" ...  "plugin16.amxx"
"op4ctf_crash"
Original.
Latest version.

Last edited by DJEarthQuake; 12-28-2023 at 07:24. Reason: update
DJEarthQuake is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-28-2023 , 23:43   Re: safemode
Reply With Quote #2

Randomly using syntactical tricks that the compiler is OK with but that makes the code harder to read for no reason is completely and utterly ridiculous. For example, randomly leaving out parentheses for functions calls is dumb (it also breaks certain intelligent code editors like AMXXPawn for VS Code).

What does this plugin have to do with "safety"?? I don't see any "safety" related functionality, though it's kinda hard to understand what your plugin does at all. What does this plugin actually do?

To prevent plugins from running on certain maps that have too many models cached, you should simply use the per-map config and plugin files that are built into AMX Mod X.

You have a whole bunch of plugins names that are hard coded into this plugin which makes it not suitable for a public release.

If you do want/need to modify the behavior of plugins in plugins.ini, you don't need to edit plugins.ini at all. There is a feature in AMX Mod X that allows you to modify the plugin list without using plugins.ini. Any file in the configs folder that begins with "plugins-" and ends with ".ini" will be loaded after plugins.ini allowing you to enable or disable plugins from there.

Regarding calling this from other plugins, if you're writing the code of the plugin that is being called by another, you don't need to use any callfunc_*() commands, just build in proper natives that can be used elsewhere like it should be. Using callfunc_*() should only be a last resort for plugins that can't practically have natives added.
__________________
fysiks is online now
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 08-29-2023 , 10:40   Re: safemode
Reply With Quote #3

The only way to resolve the 512 error you must not precache over 512 models/sounds/sprites.
Check precache kit on my signature for more information.
__________________
Jhob94 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-30-2023 , 07:24   Re: safemode
Reply With Quote #4

Thanks for the feedback. It makes a short plugins.ini list from base system. Nothing unreleased. This happens just before the map is loaded however it is called. Using natives makes it more of a project to install for admin as well as all the work involved with cache manipulation configs. Both too complex for regular admins to install. Those are deterrents. When host has myriad of plugins typing out disabled alongside each one in the built-in ini system is not going to work, it is loaded too late. In fact avoiding use of it by-and-large except for adding a plugin back by prefix on occasion and use this 1 file instead of many option instead is safer than removing cache items IMHO. Windows has a safe mode which loads a minimal set of drivers. Name was inspired by that. There are no third party plugins forced and hard coded anywhere. Users make their own safe_mode.ini or don't. If you are talking about a piece of my for the sake of an example config, that's what eg means. Users make their own. Just list the map name. Add up to 12 plugins to sandbox. True safemode would be starting with no plugins then adding one at a time. It is much easier to manage on 1 file. Precaching is not the only way. It takes something away from the map I thought.
DJEarthQuake is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-30-2023 , 23:00   Re: safemode
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
Thanks for the feedback. It makes a short plugins.ini list from base system. Nothing unreleased. This happens just before the map is loaded however it is called.
plugin_end() is always called before the map actually changes. Any plugin file modifications can be done here (I do this successfully in one of my plugins). Also, your plugin can't properly handle any plugins loaded in any other plugin INI files so it just doesn't make sense.

Quote:
Originally Posted by DJEarthQuake View Post
Using natives makes it more of a project to install for admin as well as all the work involved with cache manipulation configs. Both too complex for regular admins to install. Those are deterrents.
Nothing in this statement is true. Using natives changes nothing about installing the plugins for the admin.

Quote:
Originally Posted by DJEarthQuake View Post
When host has myriad of plugins typing out disabled alongside each one in the built-in ini system is not going to work, it is loaded too late.
That makes no sense. It's not hard to comment out plugins in plugins.ini. Using "disabled" is only needed when you're using map-specific plugin INI files alternate plugin INI files.

What is loaded too late? Late relative to what?

Quote:
Originally Posted by DJEarthQuake View Post
In fact avoiding use of it by-and-large except for adding a plugin back by prefix on occasion and use this 1 file instead of many option instead is safer than removing cache items IMHO.
What is are "cache items"? There is no concept of "cache" with respect to loading plugins.

Quote:
Originally Posted by DJEarthQuake View Post
Windows has a safe mode which loads a minimal set of drivers. Name was inspired by that.
This type of debugging is rare and is so easy that you don't need to complicate it with a really confusing plugin.


Quote:
Originally Posted by DJEarthQuake View Post
There are no third party plugins forced and hard coded anywhere.
I didn't say anything about "third party plugins". There are several plugins hard coded here. Not everybody will necessarily have or want to use the default plugins, even in "safe mode".


Quote:
Originally Posted by DJEarthQuake View Post
Precaching is not the only way. It takes something away from the map I thought.
Prechaching has thing to do with this, not sure why you mention it.
__________________
fysiks is online now
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-03-2023 , 12:12   Re: safemode
Reply With Quote #6

Anything to do with cache was per Jhob94’s comment. Everything else yours.

Editing safe_mode.ini, one file, in configs directory putting map name down instead of modifying multiple files in configs/maps every time plugins are added is incomparable. It’s significantly less work and without margin of error.

There is a delay before configs/maps is reached. Plugins are all loaded before some are disabled. That’s when the crashes occur.
https://github.com/alliedmodders/amx...b4bfc5bb343362

On the plugin end. When I first tried this on plugin_end it did not work 100% of the time or at all. That was years ago and I did not make any notes. So I checked when maps change, what plugins are responsible. That handled it in all situations. If you are saying I can make it work with less work, I am open to that. Thank you.

There are some other ideas that I can test to address plugin_end consolidation again.

Admin.amxx is part of the base system and that was put in as a fail-safe so admins still are admins when using this plugin. If I did not put it there, Amxx is completely hosed until somebody gets to the console or waits for nextmap. Either way that’s unprofessional. Suggesting admin.amxx as a 3rd party plugin is rather Orwellian.

What I thought about was 2 plugins.ini. One for base system and other for all 3rd party plugins. I used to do that.

Base is always loaded then if map is not on the list the other 3rd party plugins.ini is loaded. Once again with the timing plugin_end was not keeping up or I thought I tested there and didn’t.
DJEarthQuake is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-04-2023 , 02:50   Re: safemode
Reply With Quote #7

Not sure how you came to the conclusion that the using the basic built-in functionality is all that hard.

I've used plugin_end() to modify which plugins are loaded since 2009 (14 years ago).

Your plugin is hard coded in several ways making it untenable for generic use. Just keep it to yourself unless you're planning on removing all the hard coded plugins and limits.


P.S. I'll try to ignore this thread from now on since you're not making any sense.
__________________

Last edited by fysiks; 09-04-2023 at 04:15.
fysiks is online now
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 09-04-2023 , 04:46   Re: safemode
Reply With Quote #8

Quote:
Originally Posted by DJEarthQuake View Post
Precaching is not the only way. It takes something away from the map I thought.
I have no idea what you are talking about. The error, as it says, is about precache. If you want to remove something you must unprecache the wanted files.
__________________
Jhob94 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-11-2023 , 01:40   Re: safemode
Reply With Quote #9

Plugin updated. All discussed issues addressed. Utilizing plugin_end. Softened code.
DJEarthQuake is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-14-2024 , 06:16   Re: safemode
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
For example, randomly leaving out parentheses for functions calls is dumb (it also breaks certain intelligent code editors like AMXXPawn for VS Code).
Never noticed since I use CLI like NANO. Merely placing a semi-colon after enum declaration. That fixes it. Functions show in the Symbols sidebar. Parenthesis has nothing to do with it. I checked.
__________________
DJEarthQuake 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:45.


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