-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.sp
More file actions
59 lines (46 loc) · 1.46 KB
/
link.sp
File metadata and controls
59 lines (46 loc) · 1.46 KB
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
#include <clientprefs>
#include <sdktools>
#include <sourcemod>
#include <shavit>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1337"
char gs_LastLink[256];
char gs_Linker[32 + 1];
chatstrings_t gS_ChatStrings;
public Plugin myinfo =
{
name = "link",
author = "may",
description = "i love kaworu",
version = PLUGIN_VERSION,
url = "Your website URL/AlliedModders profile URL"
};
public void OnPluginStart()
{
RegConsoleCmd("sm_link", Command_Link, "link");
RegConsoleCmd("sm_open", Command_Open, "open");
}
public void Shavit_OnChatConfigLoaded()
{
Shavit_GetChatStringsStruct(gS_ChatStrings);
}
public Action Command_Link(int client, int args)
{
char buffer[256];
GetCmdArgString(buffer, sizeof(buffer));
if (StrContains(buffer, "http", false) < 0)
{
PrintToChat(client, "\"%s%s%s\" isn't a valid link!", gS_ChatStrings.sWarning, buffer, gS_ChatStrings.sText);
return Plugin_Handled;
}
GetClientName(client, gs_Linker, sizeof(gs_Linker));
gs_LastLink = buffer;
Shavit_StopChatSound();
PrintToChatAll("%s%N%s has posted a link: %s%s%s (view it with !%sopen%s)", gS_ChatStrings.sStyle, client, gS_ChatStrings.sText, gS_ChatStrings.sWarning, gs_LastLink, gS_ChatStrings.sText, gS_ChatStrings.sVariable, gS_ChatStrings.sText);
return Plugin_Handled;
}
public Action Command_Open(int client, int args)
{
ShowMOTDPanel(client, gs_Linker, gs_LastLink, 2);
}