This code introduces a new table in the database and some new functions to allow the admins/GMs of a server to whitelist specific accounts to have more than X number of characters. The intended use case is for GMs to set a baseline character count limit (which can be any number greater than 0), and then allow specific people to make more characters up to an arbitrarily high limit.
To change the number of characters that EVERYONE is allowed to make by default without Admin intervention, change this line (line 16 of the file):
- Code: Select all
DECLARE retval INT DEFAULT 1;
change the "1" to the number you want to allow by default. The numbers you set for individual accounts may be lower OR higher than this value.
Setup
The SQL code for the procedure needs to be submitted to your MySQL or MariaDB server (I will refer to this generically as "your SQL server" from here on out, but I am NOT referring to the product Microsoft SQL Server, since that isn't supported by LiF:YO). The in-game console does not accept SQL, so you must execute it on your SQL server.
How you do that will depend on how your server is set up. If you have never connected to your SQL server directly before, you must learn how to do that on your own. I can't tell you how to connect to your SQL server, because it depends on how you installed it, what platform you installed it on, whether it's MySQL or MariaDB, whether you're hosted or running a dedicated server, etc. If you don't know how to do this, consider that a project for you to complete as a pre-requisite before you are able to use this mod.
Once you have access to your SQL server, simply submit the contents of the mod (linked to at the start of the post) to your SQL server as a query. There are literally hundreds of different ways to do this, that range from web interfaces, desktop apps like HeidiSQL, or console commands like mysql.
Example usage
You can call any of the functions or procedures exposed by the mod in your own SQL statements. However, the simplest way is to pass an existing character name to the query to increase the number for a specific account by 1.
Assuming you have the mod installed, you can add 1 to the character limit of the account associated with a given character first name as follows:
- Code: Select all
CALL p_incrementCharacterLimitByName('Coorbin');
This SQL code will increase the character limit of the account associated with the character "Coorbin" by 1. To increase it by a small number greater than 1, you can just run the procedure repeatedly. The resultset returned will contain the new limit.
Limitations
1. If the user tries to create a character in excess of their limit, they will receive this cryptic error message:
I don't think we can do anything to make this more user-friendly right now, because the string in the message box is defined on the client side.
2. If the user has more characters than their limit already created before you implement this mod, those characters will not be changed or deleted in any way. You may consider this a good or a bad thing, but just be aware of it. So if someone has 5 or 6 characters already, this will prevent them from making any more, but you will have to (manually) find out who has those characters, and then decide what to do about them.