--- /dev/null
+#include <sourcemod>\r
+#define Version "0.1"\r
+\r
+new Handle:despawn;\r
+\r
+public Plugin:myinfo = {\r
+ name = "Limited weapons",\r
+ author = "furrycat",\r
+ description = "Limits weapon availibility.",\r
+ version = Version,\r
+};\r
+\r
+public OnPluginStart() {\r
+ decl String:ModName[50];\r
+ GetGameFolderName(ModName, sizeof(ModName));\r
+\r
+ if (!StrEqual(ModName, "left4dead", false)) {\r
+ SetFailState("This mod is for Left 4 Dead only.");\r
+ }\r
+\r
+ /* Set up cvars. */\r
+ despawn = CreateConVar("limited_weapons_despawn", "1", "Remove weapon spawners immediately after use.");\r
+\r
+ AutoExecConfig(true, "limited_weapons");\r
+\r
+ /* Hooks. */\r
+ HookEvent("spawner_give_item", spawner_give_item_callback);\r
+}\r
+\r
+/* Remove item spawner as soon as it has given an item. */\r
+public spawner_give_item_callback(Handle:event, const String:name[], bool:dontBroadcast) {\r
+ if (GetConVarInt(despawn)) {\r
+ new spawner = GetEventInt(event, "spawner");\r
+ if (IsValidEntity(spawner)) RemoveEdict(spawner);\r
+ }\r
+}\r
+ \r
+public OnMapStart() {\r
+}\r
+\r
+public OnMapEnd() {\r
+}\r
+\r