Forum

> > CS2D > Scripts > Check offline player data.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Check offline player data.

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Check offline player data.

minos
User Off Offline

Zitieren
Hello guys , I have made an auto demotion system, right now it's working good but only if the month finished and the player was online, i need a way to check offline players data like this :
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("minute","minute_")
function minute_(id)
if maxtime > 43800 then 
if PLAYERS[id].hours < 8 then 
if PLAYERS[id].rank < 80 then 
PLAYERS[id].rank = PLAYERS[id].rank - 10
PLAYERS[id].hours = 0 
end
end
maxtime = 0 
end
end
-- I Have a data save of players i need a way to load them when the maxtime > 43800 then the server check if PLAYERS[id]>=8 then if not it will demote him even if he was offline in that moment

alt Re: Check offline player data.

Talented Doge
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
allplayers = [}

local a = tonumber(os.date("%d"))
for a in io.popen([[dir "D:\SteamLibrary\steamapps\common\CS2D\sys\lua\saves\" /b /o:e]]):lines() do
     if string.sub(a, -3) == "txt" then table.insert(allplayers, a)
     else break end
end
--[[ the table will be like this:
	{131785, 123456, 161728}
]]

if tonumber(os.date("%d")) == 1 then -- if today is the start of a month
	for i = 1, #allplayers do
		loadplayer(allplayers[i]) -- or your own functions
		if PLAYERS[id].hours < 8 and PLAYERS[id].rank < 80 then 
			PLAYERS[id].rank = PLAYERS[id].rank - 10
			PLAYERS[id].hours = 0
		end
	end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht