-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiscord_utilities.sp
77 lines (62 loc) · 2.1 KB
/
discord_utilities.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
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <sourcemod>
#include <autoexecconfig>
#include <SteamWorks>
#include <discord>
#include <discord_utilities>
#undef REQUIRE_PLUGIN
#define USES_CHAT_COLORS
#include <shavit>
#include <multicolors>
#define REQUIRE_PLUGIN
#include "discord_utilities/globals.sp"
#include "discord_utilities/natives.sp"
#include "discord_utilities/discordrequest.sp"
#include "discord_utilities/helpers.sp"
#include "discord_utilities/forwards.sp"
#include "discord_utilities/sql.sp"
#include "discord_utilities/modules.sp"
#pragma dynamic 500000
#pragma newdecls required
#pragma semicolon 1
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESC,
version = PLUGIN_VERSION,
url = PLUGIN_URL
};
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
g_bLateLoad = late;
RegPluginLibrary("DiscordUtilities");
CreateNative("DU_IsChecked", Native_IsChecked);
CreateNative("DU_IsMember", Native_IsDiscordMember);
CreateNative("DU_GetUserId", Native_GetUserId);
CreateNative("DU_RefreshClients", Native_RefreshClients);
CreateNative("DU_AddRole", Native_AddRole);
CreateNative("DU_DeleteRole", Native_DeleteRole);
g_hOnLinkedAccount = CreateGlobalForward("DU_OnLinkedAccount", ET_Ignore, Param_Cell, Param_String, Param_String, Param_String);
g_hOnAccountRevoked = CreateGlobalForward("DU_OnAccountRevoked", ET_Ignore, Param_Cell, Param_String);
g_hOnCheckedAccounts = CreateGlobalForward("DU_OnCheckedAccounts", ET_Event, Param_String, Param_String, Param_String);
g_hOnMemberDataDumped = CreateGlobalForward("DU_OnMemberDataDumped", ET_Ignore);
return APLRes_Success;
}
public void OnPluginStart()
{
hRateLeft = new StringMap();
hRateReset = new StringMap();
hRateLimit = new StringMap();
CreateCvars();
RegConsoleCmd("sm_unlink", Cmd_Unlink);
RegConsoleCmd("sm_unverify", Cmd_Unlink);
LoadTranslations("Discord-Utilities.phrases");
if(g_bLateLoad)
{
OnAllPluginsLoaded();
OnPluginEnd();
OnConfigsExecuted();
CreateTimer(5.0, Timer_RefreshClients, _, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(15.0, VerifyAccounts, _, TIMER_FLAG_NO_MAPCHANGE);
}
}