-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuga_pm.sp
63 lines (53 loc) · 1.55 KB
/
fuga_pm.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
public Plugin myinfo =
{
name = "MapList (pm)",
author = "뿌까",
description = "하하하하",
version = "1.0",
url = "x"
};
public OnPluginStart()
{
HookEvent("teamplay_game_over", GameOver);
HookEvent("tf_game_over", GameOver);
// HookEvent("player_spawn", GameOver);
RegAdminCmd("sm_pm", MapList, 0);
}
public Action:GameOver(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:sPath[PLATFORM_MAX_PATH], String:sMap[256], String:year[20], String:mon[20], String:day[20];
GetCurrentMap(sMap, sizeof(sMap));
FormatTime(year, sizeof(year), "%Y", -1);
FormatTime(mon, sizeof(mon), "%m", -1);
FormatTime(day, sizeof(day), "%d", -1);
BuildPath(Path_SM, sPath, sizeof(sPath), "data/pm/%s-%s-%s.txt", year, mon, day);
new Handle:hFile = OpenFile(sPath, "a+");
if(hFile != INVALID_HANDLE)
{
WriteFileLine(hFile, "%s", sMap);
FlushFile(hFile);
CloseHandle(hFile);
}
}
public Action:MapList(client, args)
{
decl String:sPath[PLATFORM_MAX_PATH], String:year[20], String:mon[20], String:day[20], String:map[256];
FormatTime(year, sizeof(year), "%Y", -1);
FormatTime(mon, sizeof(mon), "%m", -1);
FormatTime(day, sizeof(day), "%d", -1);
BuildPath(Path_SM, sPath, sizeof(sPath), "data/pm/%s-%s-%s.txt", year, mon, day);
new Handle:hFile;
if(FileExists(sPath, true))
{
hFile = OpenFile(sPath, "r");
while(ReadFileLine(hFile, map, sizeof(map)))
{
PrintToChat(client, map);
PrintToServer(map);
}
FlushFile(hFile);
CloseHandle(hFile);
}
else PrintToChatAll("\x04기록이 없습니다.");
return Plugin_Handled;
}