Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit cc732e8

Browse files
author
404UNFca
committed
Updating the plugin templates. Left some comments with tips in there too.
1 parent 1ea9c90 commit cc732e8

File tree

8 files changed

+81
-145
lines changed

8 files changed

+81
-145
lines changed

Resources/Misc/Templates/CSSCSGOTemplate.sp

Lines changed: 0 additions & 33 deletions
This file was deleted.

Resources/Misc/Templates/EmptyScriptTemplate.sp

Whitespace-only changes.

Resources/Misc/Templates/OldSyntaxCSSCSGOTemplate.sp

Lines changed: 0 additions & 31 deletions
This file was deleted.

Resources/Misc/Templates/OldSyntaxScriptTemplate.sp

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,53 @@
1-
#pragma semicolon 1
1+
#include <sourcemod>
2+
#include <tf2_stocks>
3+
// ^ tf2_stocks.inc itself includes sdktools.inc and tf2.inc
24

3-
#define DEBUG
5+
/**
6+
* @note #file is a somewhat recent discovery.
7+
* Instead of the full filepath, compile.exe will use
8+
* whatever name you supply here when printing errors/warnings.
9+
*/
10+
#file "Enter plugin name here"
11+
12+
#pragma semicolon 1
413

5-
#define PLUGIN_AUTHOR ""
614
#define PLUGIN_VERSION "0.00"
715

8-
#include <sourcemod>
9-
#include <sdktools>
10-
#include <tf2>
11-
#include <tf2_stocks>
12-
//#include <sdkhooks>
16+
EngineVersion:g_engineversion;
1317

1418
public Plugin:myinfo =
1519
{
16-
name = "",
17-
author = PLUGIN_AUTHOR,
18-
description = "",
20+
name = "Name of plugin here!",
21+
author = "Your name here!",
22+
description = "Brief description of plugin functionality here!",
1923
version = PLUGIN_VERSION,
20-
url = ""
24+
url = "Your website URL/AlliedModders profile URL"
2125
};
2226

23-
public OnPluginStart()
27+
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
2428
{
29+
// No need for the old GetGameFolderName setup.
30+
g_engineversion = GetEngineVersion();
31+
if (g_engineversion != Engine_TF2)
32+
{
33+
SetFailState("This plugin was made for use with Team Fortress 2 only.");
34+
}
35+
}
2536

37+
public OnPluginStart()
38+
{
39+
/**
40+
* @note For the love of god, please stop using FCVAR_PLUGIN.
41+
* Console.inc even explains this above the entry for the FCVAR_PLUGIN define.
42+
* "No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk."
43+
*/
44+
CreateConVar("sm_pluginnamehere_version", PLUGIN_VERSION, "Standard plugin version ConVar. Please don't change me!", FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
2645
}
46+
47+
public OnMapStart()
48+
{
49+
/**
50+
* @note Precache your models, sounds, etc. here!
51+
* Not in OnConfigsExecuted! Doing so leads to issues.
52+
*/
53+
}

Resources/Misc/Templates/ScriptTemplate.sp

Lines changed: 0 additions & 25 deletions
This file was deleted.

Resources/Misc/Templates/SimpleScriptTemplate.sp

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,54 @@
1-
#pragma semicolon 1
1+
#include <sourcemod>
2+
#include <tf2_stocks>
3+
// ^ tf2_stocks.inc itself includes sdktools.inc and tf2.inc
24

3-
#define DEBUG
5+
/**
6+
* @note #file is a somewhat recent discovery.
7+
* Instead of the full filepath, compile.exe will use
8+
* whatever name you supply here when printing errors/warnings.
9+
*/
10+
#file "Enter plugin name here"
11+
12+
#pragma semicolon 1
13+
#pragma newdecls required
414

5-
#define PLUGIN_AUTHOR ""
615
#define PLUGIN_VERSION "0.00"
716

8-
#include <sourcemod>
9-
#include <sdktools>
10-
#include <tf2>
11-
#include <tf2_stocks>
12-
//#include <sdkhooks>
17+
EngineVersion g_engineversion;
1318

1419
public Plugin myinfo =
1520
{
16-
name = "",
17-
author = PLUGIN_AUTHOR,
18-
description = "",
21+
name = "Name of plugin here!",
22+
author = "Your name here!",
23+
description = "Brief description of plugin functionality here!",
1924
version = PLUGIN_VERSION,
20-
url = ""
25+
url = "Your website URL/AlliedModders profile URL"
2126
};
2227

23-
public void OnPluginStart()
28+
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
2429
{
30+
// No need for the old GetGameFolderName setup.
31+
g_engineversion = GetEngineVersion();
32+
if (g_engineversion != Engine_TF2)
33+
{
34+
SetFailState("This plugin was made for use with Team Fortress 2 only.");
35+
}
36+
}
2537

38+
public void OnPluginStart()
39+
{
40+
/**
41+
* @note For the love of god, please stop using FCVAR_PLUGIN.
42+
* Console.inc even explains this above the entry for the FCVAR_PLUGIN define.
43+
* "No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk."
44+
*/
45+
CreateConVar("sm_pluginnamehere_version", PLUGIN_VERSION, "Standard plugin version ConVar. Please don't change me!", FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
2646
}
47+
48+
public void OnMapStart()
49+
{
50+
/**
51+
* @note Precache your models, sounds, etc. here!
52+
* Not in OnConfigsExecuted! Doing so leads to issues.
53+
*/
54+
}

0 commit comments

Comments
 (0)