Added play time and maps played check

This commit is contained in:
Cooldude2606
2020-09-08 18:55:13 +01:00
parent a84c42aa3c
commit d317751a10
2 changed files with 15 additions and 5 deletions

View File

@@ -2,6 +2,8 @@
-- @config Roles
local Roles = require 'expcore.roles' --- @dep expcore.roles
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
local Statistics = PlayerData.Statistics
--- Role flags that will run when a player changes roles
Roles.define_flag_trigger('is_admin',function(player,state)
@@ -166,6 +168,7 @@ Roles.new_role('Partner','Part')
'command/unjail'
}
local hours10, hours250 = 10*216000, 250*60
Roles.new_role('Veteran','Vet')
:set_permission_group('Trusted')
:set_custom_color{r=140,g=120,b=200}
@@ -174,9 +177,12 @@ Roles.new_role('Veteran','Vet')
'command/chat-bot',
}
:set_auto_assign_condition(function(player)
game.print('Checked auto assign vet')
if player.online_time > 10*216000 then
if player.online_time >= hours10 then
return true
else
local stats = Statistics:get(player, {})
local playTime, afkTime, mapCount = stats.Playtime or 0, stats.AfkTime or 0, stats.MapsPlayed or 0
return playTime - afkTime >= hours250 and mapCount >= 25
end
end)
@@ -193,6 +199,7 @@ Roles.new_role('Member','Mem')
'command/save-quickbar'
}
local hours3, hours15 = 3*216000, 15*60
Roles.new_role('Regular','Reg')
:set_permission_group('Standard')
:set_custom_color{r=79,g=155,b=163}
@@ -205,9 +212,12 @@ Roles.new_role('Regular','Reg')
'standard-decon'
}
:set_auto_assign_condition(function(player)
game.print('Checked auto assign reg')
if player.online_time > 3*216000 then
if player.online_time >= hours3 then
return true
else
local stats = Statistics:get(player, {})
local playTime, afkTime, mapCount = stats.Playtime or 0, stats.AfkTime or 0, stats.MapsPlayed or 0
return playTime - afkTime >= hours15 and mapCount >= 5
end
end)

View File

@@ -25,7 +25,7 @@ command-error-log-format=[ERROR] command/__1__ :: __2__
[expcore-roles]
error-log-format-flag=[ERROR] roleFlag/__1__ :: __2__
error-log-format-promote=[ERROR] rolePromote/__1__ :: __2__
error-log-format-assign=[ERROR] rolePromote/__1__ :: __2__
game-message-assign=__1__ has been assigned to __2__ by __3__
game-message-unassign=__1__ has been unassigned from __2__ by __3__
reject-role=Invalid Role Name.