Allows you to easily manage and store player preferences, such as hats, music and other settings.
With this plugin, players can easily save and load their preferences, even on different servers. This means they can quickly and easily return to their preferred settings without having to manually adjust settings every time they join a new server.
- From the
migrations
folder, take thecreate_tables.sql
file and import it into your database - Put the contents of the scripting folder in the directory of your server (your_server_folder/cstrike/addons/amxmodx/scripting)
- Compile
player_prefs.sma
how to compile? - Add
player_prefs.amxx
into yourplugins.ini
file - Restart server or change map
- After restarting the server or changing the map, a config will be created in the folder
/cstrike/addons/amxmodx/configs/plugins
with the nameplugin-player_prefs.cfg
. In this config, enter the data to connect to your database - Use API to create your own plugins that allow you to save user preferences!
#include <amxmodx>
#include <player_prefs>
new const KEY[] = "enable_music";
new const DEFAULT_VALUE[] = "true";
new bool: g_bMusic[MAX_PLAYERS + 1];
public plugin_init() {
register_plugin("PP Music", "1.0.0", "ufame");
register_clcmd("say /music", "music_command");
}
public pp_init() {
pp_set_key_default_value(KEY, DEFAULT_VALUE);
}
public pp_player_loaded(const id) {
g_bMusic[id] = pp_get_bool(id, KEY);
}
public music_command(id) {
g_bMusic[id] = !g_bMusic[id];
pp_set_bool(id, g_bMusic[id]);
}
Another see pp_test.sma. This plugin is only for testing, but it fully works