Script Name: LogInSystem
Script Description: Database-driven account manager. Stores individual stats for every registered-player.
Original Author(s): CurryWurstCore Version: 2.6.5
Compile Test: PassedLicense: Creative Commons
::Features::
- Database-driven account manager: Players are able to create an account in order to save and track their personal stats.
- Over 15 unique stats: Kills, Deaths, Selfkills, Visits, Time Played, Damage Dealt, Double Kills and much more ...
- Customizable stats: Modify default stats according to your own ideas, or just create your favorite stats yourself - be creative, it's easy!
- Implemented ranking system: What rank could you achieve? - Sorts the entire accounts by a certain statistic you defined.
- Multilingual user interface: Don't speak English? - No worries, choose your preferred language and LogInSystem will adapt to it!
- Database repair: Auto restores and cleans corrupted user accounts.
- Backup function: Lost your account? - Check your old account data to help you restore it.
- MD5 password encryption: Secures important user data like passwords from theft.
- Subadminlogin: Recruit sub-admins to help you managing your server.
::In-game commands::/create | > create a new account |
/login | > to log in to an existing account |
/logout | > to log out of your existing account |
/delete | > delete an existing account |
/change <password> | > change your account password |
/stats [accountname] | > to view your/others profile & stats |
/rankings [number] | > list all players in highest ranking order |
|
|
/help | > to see all commands listed above |
::Installation::1. Download the ZIP archive from
here2. Extract the content of the ZIP to your dedicated server root
3. Move the folder LogInSystem to your ./scripts/ directory
(4.) Set your directory permissions of loginsystem_data to 755 if you run the script on linux
5. Have a look at the config file and modify it according to your wishes
6. Start your server ...
7. Enjoy!
::Usage of Backup System::It's particularly important that you know how to deal with the
backup function properly, in order to avoid possible data loss.
Hence, have a brief look at the following table:
Period | Example | Result |
never | BackupFreq= | No backup will ever be created |
daily | BackFreq=daily | New backup will be created once a day |
weekly | BackupFreq=weekly Friday | Every Friday all user accounts will be saved |
monthly | BackupFreq=monthly 01 | On the first day of every month a new backup will be created |
Note: If you intend to create a new backup weekly keep in mind
that weekdays have to be written in the language of the OS
which the server runs on.
::Subadminlogin::Sub-admin rights will be automatically granted to appropriate accounts when the
player logs in.
You can add a new sub-admin while you're logged in as sub-admin by
typing: /subadmin <accountname>
::Customizing Your own Stats::1. Overview: First of all make yourself familiar with the following
pascal type:
type TStatistic = record
Alias: string;
IsVisible: boolean;
Checksum: string;
SValue: string;
IgnoreBots: boolean;
ShowSession: boolean;
end;
It may look like this, for example:
[MyStat]
1
\d+
0
1
true
2. Summary:Alias | Statistic name |
IsVisible | Is stat visible for user? |
Checksum | Depending on whether your stat typifies an integer or string value create an appropriate checksum |
SValue | Default value, used by account creation process |
IgnoreBots | Regulates the influence of bots on gameplay stats |
ShowSession | Is stat session displayed? |
The
checksum is based on regular expressions (abbr.: regex),
a guide can be found
here.
Note: If you have understood my instructions so far go on reading.
If not, leave me a message with your question(s) below.
3. Implementation: a) Think about a suitable statistic name (alias)
b) Open /loginsystem_data/localization/language.txt and append your statistic name at the end of
each language passage
c) Open /loginsystem_data/stats/costum.txt and create an entirely new section for your stat according to step
1.4. Getting Started:Your statistic is now ready to be used in the script,
here we go ...
Choose an event at which the statistic will be updated, for instance:
OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
end;
When you have picked an event, update the stat by utilizing one of the following
functions:
_UpdateColumn() | > updates a stat representing an integer value by increasing its old value by a new value |
_SetColumn() | > updates a stat representing a string value by replacing its old value with a new one |
function _UpdateColumn(Row, Column, Increase: integer): string;
var
pos: integer;
data: string;
begin
if (_RowExists(Row)) then
begin
pos:= _getColumnInfo(Row, Column);
if (pos > 0) then
begin
data:= GetPiece(Database[Row], #9, Column);
if (RegExpMatch('^-?\d+$', data)) then
begin
result:= IntToStr(StrToInt(data) + Increase);
Delete(Database[Row], pos, length(data));
Insert(result, Database[Row], pos);
end;
end;
end else
begin
OnErrorOccur('_UpdateColumn(): row does not exist', true);
end;
end;
function _SetColumn(Row, Column: integer; Value: string): boolean;
var
pos: integer;
data: string;
begin
if (_RowExists(Row)) then
begin
pos:= _getColumnInfo(Row, Column);
if (pos > 0) then
begin
data:= GetPiece(Database[Row], #9, Column);
Delete(Database[Row], pos, length(data));
Insert(Value, Database[Row], pos);
result:= true;
end;
end else
begin
OnErrorOccur('_SetColumn(): row does not exist', true);
end;
end;
I don't think it's plain to see how both functions work.
Therefore, in case you're dealing with them, I listed a few points
about the arguments...
Row: Defines the account which will be updated. For both functions the
account number (Account[ID]) needs to be passed on.
Column: Statistic element which will be changed. For both functions it's necessary to pass on the
statistic number.
Increase: Value the statistic will be increased by.
Value: String the statistic value will be replaced with.
Here's an overview of the statistic numbers:
_______________________________
|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\.:: Statistics ::.\\\\\\\\\\
/////////////////////////////////
|// - 0 - Nickname ///
|// - 1 - Password ///
|// - 2 - Language ///
|// - 3 - Server Rights ///
|// - 4 - Last Used IP ///
|// - 5 - Last Login ///
|// - 6 - Visits ///
|// - 7 - Time Played ///
|== - 8 - Kills (O)
|\\ - 9 - Deaths \\\
|\\ - 10 - Selfkills \\\
|\\ - 11 - Flag Captures \\\
|\\ - 12 - Flag Returns \\\
|\\ - 13 - Scores \\\
|\\ - 14 - Damage Dealt \\\
|\\ - 15 - Double Kills \\\
|\\ - 16 - Rank \\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//////.:: Statistics ::./////////
|////////////////////////////////
5. Final stage:To sum it up, you can realize a statistic implementation by
putting all things together:
OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
_UpdateKey(Account[Killer], 17, 1);
Inc(Session[Killer][11], 1);
end;
Note: By the way don't forget to update the session data
of the stat by increasing its integer value.
Perhaps it looks difficult to create your own stat, when you view this
guide your first time, but practice makes perfect
On that note, have fun creating your own stats!
::Future intentions:: - a widely varying offer of achievements
- more stats encouraging people to play together as team
- support for more languages - visit the official language topic
- function to show stats on the web
- support for optional formula all accounts can be ordered by
::Credits to::-
KeYDoN for inspiring me to start programming soldat scripts and for his helpful support
-
Indi for giving me a lot of inspiration for new ideas
-
EnEsCe for his amazing script core & scripting manual
-
xmRipper for translating LogInSystem into Turkish, as well as for his server support
-
DorkeyDear for creating the script 'Number of Visits' - the foundation for LogInSystem
-
" & danmer - for their function MD5()
-
Avarax for his function FillWith()
-
Gizdfor his code Double, Triple, Multi... Kills
-
homerofgods for his fancy statistic ideas :p
-
all translators , which helped me to internationalize this script
By the way ....
Happy Soldat 1.6.0rc1! EnEsCe server customers please download this
script.