-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathskyboxfix.sp
36 lines (29 loc) · 843 Bytes
/
skyboxfix.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
#include "sourcemod"
#define SNAME "[skyboxfix] "
public Plugin myinfo =
{
name = "Skybox Fix",
author = "GAMMA CASE",
description = "Replaces missing skybox with valid one.",
version = "1.0.0",
url = "https://steamcommunity.com/id/_GAMMACASE_/"
};
ConVar gSvSkyname;
public void OnPluginStart()
{
gSvSkyname = FindConVar("sv_skyname");
if(!gSvSkyname)
SetFailState("Failed to find \"sv_skyname\" cvar.");
}
public void OnMapStart()
{
char buff[PLATFORM_MAX_PATH], buff2[PLATFORM_MAX_PATH];
gSvSkyname.GetString(buff, sizeof(buff));
Format(buff2, sizeof(buff2), "materials/skybox/%sbk.vmt", buff);
if(!FileExists(buff2, true))
{
GetCurrentMap(buff2, sizeof(buff2));
LogMessage("\"%s\" is using invalid skybox \"%s\", replacing...", buff2, buff);
gSvSkyname.SetString("dustblank");
}
}