lua/guthlevelsystem/sh_config.lua
For now, there are 2 default HUDs that you can choose to use (or not) :
default_progress
default_text
Custom HUDs are located in lua/guthlevelsystem/hud
and you can choose one by specifying the configuration variable guthlevelsystem.settings.hud.selected
in sh_config.lua
ULX, SAM & xAdmin2 have common commands implemented for managing levels and XPs of players, such as :
gls_add_xp <player> <amount>
: Add amount
XP to player
gls_add_level <player> <amount>
: Add amount
level to player
gls_set_xp <player> <amount>
: Set player
's XP to amount
gls_set_level <player> <amount>
: Set player
's level to amount
Adding a level constraint to a DarkRP job is quite simple, you have to add a variable level = X,
(or LSlvl = x
; default to 0
) to it and to replace X
by the level wanted. See example below
Example, TEAM_RANDOM
is accessible at least at level 5
:
TEAM_RANDOM = DarkRP.createJob("Random", {
color = Color(226, 47, 255, 255),
model = {"models/player/eli.mdl"},
description = [[waw]],
weapons = {},
command = "random",
max = 1,
salary = 0,
admin = 0,
vote = false,
hasLicense = false,
candemote = false,
LSlvl = 5, -- here is my required level to be able to choose the job
level = 5, -- or, I can write it like that!
})
Adding a prestige condition is similar to the level, you have to add an other variable prestige = Y,
(default to 0
) to the job, again, replace Y
by the prestige wanted. See example below
Example, TEAM_VIP
is accessible at least at level 5
of the 2
nd prestige :
TEAM_VIP = DarkRP.createJob("VIP", {
color = Color(226, 47, 255, 255),
model = {"models/player/gman.mdl"},
description = [[wuw]],
weapons = {},
command = "vip",
max = 1,
salary = 0,
admin = 0,
vote = false,
hasLicense = false,
candemote = false,
LSlvl = 5, -- here is my required level to be able to choose the job
level = 5, -- or, I can write it like that!
prestige = 2, -- and here's my prestige minimum!
})
If you don't want to make a job only available from a level X
from any prestige Y
, add the variable has_level_priority = true,
(default to false
) to your job.
For instance, a job set to level 20
and prestige 2
:
has_level_priority == false
: you can enter the job when you reach the level 20
of the 2
nd prestige (& the 1
st level of the 3
rd prestige works too) has_level_priority == true
: you must be at least level 20
of the 2
nd prestige too (but 1
st level of the 3
rd prestige doesn't work because you have to be level 20
) If you just want a basic saving system (default: SQLite), just ignore that part.
This level system is compatible with Gabyfle/gSQL library, which means that you can easily use a different SQL driver such as MySQLOO or tMySQL4 by downloading and installing theses systems on your server.
As said before, you have to install Gabyfle/gSQL and the SQL driver of your choice. Once it's done, configure the database file (at the top) of my system located at lua/guthlevelsystem/sv_data.lua
(it's not located at sh_config.lua
for security reasons).
guthlevelsystem_set_lvl <level> <name>
: Set level <level>
to <name>
(if specified, else level go to the user who call command)guthlevelsystem_add_lvl <level> <name>
: Add level <level>
to <name>
(if specified, else level go to the user who call command)guthlevelsystem_set_xp <xp> <name>
: Set XP <xp>
to <name>
(if specified, else XP go to the user who call command)guthlevelsystem_add_xp <xp> <name>
: Add XP <xp>
to <name>
(if specified, else XP go to the user who call command)guthlevelsystem_info
: Show info of the addon/!\ The API changed in the version 2.0.0, if you use my addon somehow, please check for incompatibilities & errors in your mod
Since the version 1.3.0, customs hooks have been added:
guthlevelsystem:on_player_init_data
ply
guthlevelsystem:on_player_save_data
ply
guthlevelsystem:on_player_reset_data
ply
guthlevelsystem:on_player_init_data
is made beforeguthlevelsystem:can_player_earn_prestige
ply
diff_prestige
Player/gls_add_prestige
or Player/gls_set_prestige
guthlevelsystem:on_player_earn_prestige
ply
diff_prestige
guthlevelsystem:can_player_earn
ply
diff_level
diff_xp
Player/gls_add_level
, Player/gls_set_level
, Player/gls_add_xp
& Player/gls_set_xp
guthlevelsystem:on_player_earn
ply
diff_level
diff_xp
guthlevelsystem:custom_xp_multiplier
ply
current_multiplier
Player/gls_get_xp_multiplier
for thatPlayer/gls_add_xp
HUDShouldDraw
name="guthlevelsystem:HUD"
false
to disable the HUDguthlevelsystem:on_loaded
Feel free to propose update, functionnalities or report bugs and exploits on the issues page my Discord.