Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
azzyr authored Sep 1, 2022
1 parent 2d8bd9d commit dd3715f
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions addons/sourcemod/scripting/TF2Classic-SchemaDownloader.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <sdktools>
#include <sourcemod>

#pragma newdecls required

public Plugin myinfo =
{
name = "TF2Classic Schema Downloader",
author = "azzy",
version = "1.0"
}

public void OnMapStart()
{
char MapName[PLATFORM_MAX_PATH], ItemSchemaPath[PLATFORM_MAX_PATH], SoundScriptPath[PLATFORM_MAX_PATH], ParticleScriptPath[PLATFORM_MAX_PATH];

GetCurrentMap(MapName, sizeof(MapName));

if(Format(ItemSchemaPath, sizeof(ItemSchemaPath), "maps/%s_items_game.txt", MapName))
{
Load(ItemSchemaPath);
PrintToServer("[TF2Classic Schema Downloader] Item Schema for map %s added to Downloads Table", MapName);
}

if(Format(SoundScriptPath, sizeof(SoundScriptPath), "maps/%s_level_sounds.txt", MapName))
{
Load(SoundScriptPath);
PrintToServer("[TF2Classic Schema Downloader] Sound Script for map %s added to Downloads Table", MapName);
}

if(Format(ParticleScriptPath, sizeof(ParticleScriptPath), "maps/%s_particles.txt", MapName))
{
Load(ParticleScriptPath);
PrintToServer("[TF2Classic Schema Downloader] Particle Script for map %s added to Downloads Table", MapName);
}
}

void Load(const char[] path)
{
PrecacheGeneric(path, true);
AddFileToDownloadsTable(path);
}

0 comments on commit dd3715f

Please sign in to comment.