I am trying to add a automatic system to give players double points on a certain day. This code should indicate every other Wednesday for every other week.
Code: Select all
if (tonumber(os.date("%V")) % 2 == 1) and (tonumber(os.date("%u")) == 3)
I edit the file sv_player_extension.lua found in pointshop/lua. The code is around line 72.
Originally
Code: Select all
if PS.Config.PointsOverTime then
timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
self:PS_GivePoints(PS.Config.PointsOverTimeAmount)
self:PS_Notify("You've been given ", PS.Config.PointsOverTimeAmount, " points for playing on the server!")
end)
end
Code: Select all
if PS.Config.PointsOverTime then
if (tonumber(os.date("%V")) % 2 == 1) and (tonumber(os.date("%u")) == 7) then
timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
self:PS_GivePoints(PS.Config.PointsOverTimeAmount * 2)
self:PS_Notify(" * * * * DOUBLE POINTS DAY * * * * ")
self:PS_Notify("You've been given ", PS.Config.PointsOverTimeAmount * 2, " points for playing on the server!")
end)
else
timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
self:PS_GivePoints(PS.Config.PointsOverTimeAmount)
self:PS_Notify("You've been given ", PS.Config.PointsOverTimeAmount, " points for playing on the server!")
end)
end
end