Spring break cleanup.
Cleaning up all useless tabs, spaces, indents, you name it.
This commit is contained in:
+149
-149
@@ -22,17 +22,17 @@ Handle g_hCVar_EntityLimit = INVALID_HANDLE;
|
||||
bool g_bEnabled = true;
|
||||
float g_fPropOrigin[3];
|
||||
|
||||
public Plugin myinfo =
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Unloze Season Event",
|
||||
author = "Neon",
|
||||
name = "Unloze Season Event",
|
||||
author = "Neon",
|
||||
description = "Unloze Season Event",
|
||||
version = "1.1",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
version = "1.1",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
};
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
{
|
||||
g_hCVar_CollectablesEnabled = CreateConVar("sm_unloze_season_collectables_enabled", "1", "Spawn Collectables.", 0, true, 0.0, true, 1.0);
|
||||
g_hCVar_RandomIntervalMin = CreateConVar("sm_unloze_season_random_interval_min", "60", "Minimum Interval between spawning Collectables.", 0, true, 0.0);
|
||||
g_hCVar_RandomIntervalMax = CreateConVar("sm_unloze_season_random_interval_max", "120", "Maximum Interval between spawning Collectables.", 0, true, 0.0);
|
||||
@@ -43,39 +43,39 @@ public void OnPluginStart()
|
||||
g_hCVar_HighscoreDisplay = CreateConVar("sm_unloze_season_highscore_display", "5", "Amount of Players to display via sm_highscore", 0, true, 0.0);
|
||||
g_hCVar_PlayerRequirement = CreateConVar("sm_unloze_season_player_requirement", "10", "Amount of Players needed to spawn Collectables.", 0, true, 0.0);
|
||||
g_hCVar_EntityLimit = CreateConVar("sm_unloze_season_entity_limit", "2000", "Entity Safety Limit.", 0, true, 0.0);
|
||||
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(IsClientInGame(client) && !IsFakeClient(client) && IsClientAuthorized(client))
|
||||
OnClientPostAdminFilter(client);
|
||||
}
|
||||
HookEvent("round_start", OnRoundStart, EventHookMode_Post);
|
||||
HookEvent("round_start", OnRoundStart, EventHookMode_Post);
|
||||
RegConsoleCmd("sm_presents", Command_Collected, "Shows the total amount of presents you have collected so far");
|
||||
RegConsoleCmd("sm_highscore", Command_HighScore, "Shows the HighScore");
|
||||
RegAdminCmd("sm_reload_season", Command_ReloadFlags, ADMFLAG_ROOT);
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
{
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.phy");
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.sw.vtx");
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.vvd");
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.mdl");
|
||||
AddFileToDownloadsTable("models/player/stenli/smite/fenrir.mdl");
|
||||
AddFileToDownloadsTable("materials/models/player/stenli/smite/fenrir/body.vmt");
|
||||
AddFileToDownloadsTable("materials/models/player/stenli/smite/fenrir/body.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/stenli/smite/fenrir/body_n.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/stenli/smite/fenrir/body_s.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/stenli/smite/fenrir/lights.vmt");
|
||||
PrecacheModel("models/player/stenli/smite/fenrir.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.vvd");
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.mdl");
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.phy");
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.sw.vtx");
|
||||
AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.sw.vtx");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_d_cos11.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_n_cos11.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36lollipop/hat.vmt");
|
||||
@@ -89,20 +89,20 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_n_cos11.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_d_cos11.vmt");
|
||||
PrecacheModel("models/player/vad36lollipop/lolli_new.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.mdl");
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.phy");
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.sw.vtx");
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.vvd");
|
||||
AddFileToDownloadsTable("models/player/vad36santa/red.vvd");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36santa/Santa_N.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36santa/Santa_D.vmt");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36santa/Santa_D.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36santa/Santa_D_B.vmt");
|
||||
AddFileToDownloadsTable("materials/models/player/vad36santa/Santa_D_B.vtf");
|
||||
PrecacheModel("models/player/vad36santa/red.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/zombieden/xmas/giftbox.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/zombieden/xmas/giftbox.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/zombieden/xmas/giftbox.mdl");
|
||||
@@ -115,7 +115,7 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("materials/models/zombieden/xmas/gift_2.vtf");
|
||||
AddFileToDownloadsTable("materials/models/zombieden/xmas/gift_lightwarp.vtf");
|
||||
PrecacheModel("models/zombieden/xmas/giftbox.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/models_kit/xmas/xmastree_mini.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/models_kit/xmas/xmastree_mini.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/models_kit/xmas/xmastree_mini.mdl");
|
||||
@@ -132,7 +132,7 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("materials/models/models_kit/xmas/xmastree_miscb_skin2.vtf");
|
||||
AddFileToDownloadsTable("materials/models/models_kit/xmas/xmastree_miscb_spec.vtf");
|
||||
PrecacheModel("models/models_kit/xmas/xmastree_mini.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/models_kit/xmas/xmas_teddybear.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/models_kit/xmas/xmas_teddybear.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/models_kit/xmas/xmas_teddybear.mdl");
|
||||
@@ -157,9 +157,9 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("models/weapons/w_revenge_xmas_candy.sw.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_revenge_xmas_candy.vvd");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/xmas_candy/cane.vmt");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/xmas_candy/cane.vtf");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/xmas_candy/cane.vtf");
|
||||
PrecacheModel("models/weapons/w_revenge_xmas_candy.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/johny-srka/snowman.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/johny-srka/snowman.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/johny-srka/snowman.mdl");
|
||||
@@ -174,8 +174,8 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("materials/models/johny-srka/snowfloor002a.vtf");
|
||||
AddFileToDownloadsTable("materials/models/johny-srka/wood_old.vmt");
|
||||
AddFileToDownloadsTable("materials/models/johny-srka/wood_old.vtf");
|
||||
PrecacheModel("models/johny-srka/snowman.mdl");
|
||||
|
||||
PrecacheModel("models/johny-srka/snowman.mdl");
|
||||
|
||||
AddFileToDownloadsTable("models/weapons/w_snowball_thrown.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_snowball_thrown.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_snowball_thrown.mdl");
|
||||
@@ -184,33 +184,33 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("models/weapons/w_snowball_thrown.vvd");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/snooball/s.vmt");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/snooball/s.vtf");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/snooball/s_norm.vtf");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/snooball/s_norm.vtf");
|
||||
PrecacheModel("models/weapons/w_snowball_thrown.mdl");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.mdl");
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.phy");
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.sw.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.vvd");
|
||||
AddFileToDownloadsTable("models/weapons/w_ornament_thrown.vvd");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/ornament/ornament.vmt");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/ornament/ornament.vtf");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/ornament/reflect.vtf");
|
||||
PrecacheModel("models/weapons/w_ornament_thrown.mdl");
|
||||
|
||||
PrecacheModel("models/weapons/w_ornament_thrown.mdl");
|
||||
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.mdl");
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.phy");
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.sw.vtx");
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.vvd");
|
||||
AddFileToDownloadsTable("models/weapons/w_santa_hat_thrown.vvd");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/eq_fraggrenade/bonnet.vmt");
|
||||
AddFileToDownloadsTable("materials/models/weapons/v_models/eq_fraggrenade/bonnet.vtf");
|
||||
PrecacheModel("models/weapons/w_santa_hat_thrown.mdl");
|
||||
|
||||
PrecacheModel("models/weapons/w_santa_hat_thrown.mdl");
|
||||
|
||||
AddFileToDownloadsTable("sound/unl1/season/hohohoho.wav");
|
||||
PrecacheSound("sound/unl1/season/hohohoho.wav");
|
||||
|
||||
PrecacheSound("sound/unl1/season/hohohoho.wav");
|
||||
|
||||
float fRandomInterval = GetRandomFloat(GetConVarFloat(g_hCVar_RandomIntervalMin), GetConVarFloat(g_hCVar_RandomIntervalMax));
|
||||
CreateTimer(fRandomInterval, SpawnCollectable, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public void OnClientPostAdminFilter(int client)
|
||||
}
|
||||
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
{
|
||||
CreateTimer(10.0, CheckPlayerCount, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public Action CheckPlayerCount(Handle timer)
|
||||
}
|
||||
|
||||
public Action Command_ReloadFlags(int client, int args)
|
||||
{
|
||||
{
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientInGame(i) && !IsFakeClient(i) && IsClientAuthorized(i))
|
||||
@@ -249,35 +249,35 @@ public Action Command_ReloadFlags(int client, int args)
|
||||
public Action Command_HighScore(int client, int args)
|
||||
{
|
||||
char error[255];
|
||||
Database db;
|
||||
Database db;
|
||||
if (SQL_CheckConfig("season"))
|
||||
{
|
||||
db = SQL_Connect("season", true, error, sizeof(error));
|
||||
}
|
||||
}
|
||||
if (db == null)
|
||||
{
|
||||
LogError("Could not connect to database: %s", error);
|
||||
delete db;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char sName[MAX_NAME_LENGTH];
|
||||
|
||||
char sName[MAX_NAME_LENGTH];
|
||||
char sQuery[255];
|
||||
char sBuffer[2048] = "{green}[Unloze XMAS] {white}TOP COLLECTORS:\n";
|
||||
char sTempBuffer[1024] = "";
|
||||
int iCollected;
|
||||
int iField;
|
||||
|
||||
Format(sQuery, sizeof(sQuery), "SELECT * from season_table order by collected desc limit %d", GetConVarInt(g_hCVar_HighscoreDisplay));
|
||||
|
||||
Format(sQuery, sizeof(sQuery), "SELECT * from season_table order by collected desc limit %d", GetConVarInt(g_hCVar_HighscoreDisplay));
|
||||
DBResultSet rs;
|
||||
if ((rs = SQL_Query(db, sQuery)) == null)
|
||||
{
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Error! Could not connect to MYSQL-DB!");
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Error! Could not connect to MYSQL-DB!");
|
||||
delete db;
|
||||
delete rs;
|
||||
return Plugin_Handled;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
for(int i = 1; i <= GetConVarInt(g_hCVar_HighscoreDisplay); i++)
|
||||
{
|
||||
rs.FetchRow();
|
||||
@@ -286,8 +286,8 @@ public Action Command_HighScore(int client, int args)
|
||||
rs.FieldNameToNum("collected", iField);
|
||||
iCollected = rs.FetchInt(iField);
|
||||
Format(sTempBuffer, sizeof(sTempBuffer), "{green}%d: %s - {red}%d \n", i, sName, iCollected);
|
||||
StrCat(sBuffer, sizeof(sBuffer), sTempBuffer);
|
||||
}
|
||||
StrCat(sBuffer, sizeof(sBuffer), sTempBuffer);
|
||||
}
|
||||
CPrintToChat(client, sBuffer);
|
||||
delete db;
|
||||
delete rs;
|
||||
@@ -298,9 +298,9 @@ public Action Command_Collected(int client, int args)
|
||||
{
|
||||
int iCollected = CheckMYSQL(client);
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}You have collected {green}%d {white}presents so far.", iCollected);
|
||||
|
||||
|
||||
if ((iCollected > GetConVarInt(g_hCVar_MilestoneInfection)) && (iCollected > GetConVarInt(g_hCVar_MilestoneSkin)))
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}You have unlocked {red}all rewards{white} already.");
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}You have unlocked {red}all rewards{white} already.");
|
||||
if (iCollected < GetConVarInt(g_hCVar_MilestoneInfection))
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}You need to collect {green}%d {white}more presents to unlock {red}INFECTION EFFECTS{white}.", GetConVarInt(g_hCVar_MilestoneInfection) - iCollected);
|
||||
if (iCollected < GetConVarInt(g_hCVar_MilestoneGrenade))
|
||||
@@ -314,32 +314,32 @@ public Action Command_Collected(int client, int args)
|
||||
public int CheckMYSQL(int client)
|
||||
{
|
||||
if (client == -1)
|
||||
return -1;
|
||||
|
||||
return -1;
|
||||
|
||||
char error[255];
|
||||
Database db;
|
||||
Database db;
|
||||
if (SQL_CheckConfig("season"))
|
||||
{
|
||||
db = SQL_Connect("season", true, error, sizeof(error));
|
||||
}
|
||||
}
|
||||
if (db == null)
|
||||
{
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Error! Could not connect to MYSQL-DB!");
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Error! Could not connect to MYSQL-DB!");
|
||||
delete db;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
char sSID[64];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
|
||||
char sQuery[255];
|
||||
Format(sQuery, sizeof(sQuery), "SELECT collected FROM season_table WHERE steam_auth = '%s'", sSID);
|
||||
Format(sQuery, sizeof(sQuery), "SELECT collected FROM season_table WHERE steam_auth = '%s'", sSID);
|
||||
DBResultSet rs;
|
||||
if ((rs = SQL_Query(db, sQuery)) == null)
|
||||
{
|
||||
delete db;
|
||||
delete rs;
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
int iCollected;
|
||||
if (!(rs.RowCount > 0))
|
||||
@@ -356,7 +356,7 @@ public int CheckMYSQL(int client)
|
||||
delete rs;
|
||||
delete db;
|
||||
CheckAndAddFlag(client, iCollected);
|
||||
return iCollected;
|
||||
return iCollected;
|
||||
}
|
||||
|
||||
public Action SpawnCollectable(Handle timer)
|
||||
@@ -367,37 +367,37 @@ public Action SpawnCollectable(Handle timer)
|
||||
|
||||
if (!GetConVarBool(g_hCVar_CollectablesEnabled) || !(g_bEnabled))
|
||||
return;
|
||||
|
||||
|
||||
int target = GetTargetClient();
|
||||
GetClientAbsOrigin(target, g_fPropOrigin);
|
||||
int iRotating = SpawnRotating();
|
||||
int iParticle = SpawnParticle();
|
||||
int iProp = SpawnProp();
|
||||
int iHitbox = SpawnHitbox(iRotating, iParticle);
|
||||
int iTrigger = SpawnTrigger(iHitbox);
|
||||
int iAmbient = SpawnAmbientHohohoho();
|
||||
int iTrigger = SpawnTrigger(iHitbox);
|
||||
int iAmbient = SpawnAmbientHohohoho();
|
||||
SetVariantString("!activator");
|
||||
AcceptEntityInput(iProp, "SetParent", iRotating);
|
||||
AcceptEntityInput(iProp, "SetParent", iRotating);
|
||||
SetVariantString("!activator");
|
||||
AcceptEntityInput(iHitbox, "SetParent", iRotating);
|
||||
SetVariantString("!activator");
|
||||
AcceptEntityInput(iTrigger, "SetParent", iRotating);
|
||||
|
||||
|
||||
AcceptEntityInput(iTrigger, "Enable");
|
||||
|
||||
|
||||
int iEntityLimit = GetConVarInt(g_hCVar_EntityLimit);
|
||||
|
||||
|
||||
if ((iRotating > iEntityLimit) || (iParticle > iEntityLimit) || (iProp > iEntityLimit) || (iHitbox > iEntityLimit) || (iTrigger > iEntityLimit) || (iAmbient > iEntityLimit))
|
||||
{
|
||||
AcceptEntityInput(iHitbox, "FireUser2");
|
||||
CPrintToChatAll("{green}[Unloze XMAS] {white}Present removed due to {red}critical amount of entities{white}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetTargetClient()
|
||||
{
|
||||
{
|
||||
int[] iEligibleClients = new int[MaxClients];
|
||||
int iClientCount = 0;
|
||||
int iClientCount = 0;
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientInGame(i) && IsPlayerAlive(i) && (ZR_IsClientHuman(i)))
|
||||
@@ -405,37 +405,37 @@ public int GetTargetClient()
|
||||
iEligibleClients[iClientCount] = i;
|
||||
iClientCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iClientCount == 0)
|
||||
return -1;
|
||||
return -1;
|
||||
int randomIndex = GetRandomInt(0, iClientCount - 1);
|
||||
return iEligibleClients[randomIndex];
|
||||
}
|
||||
|
||||
public void HookCallbackTrigger(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
{
|
||||
if (!ZR_IsClientHuman(activator))
|
||||
{
|
||||
UnhookSingleEntityOutput(caller, "OnStartTouch", HookCallbackTrigger);
|
||||
AcceptEntityInput(caller, "FireUser1");
|
||||
CPrintToChatAll("{green}[Unloze XMAS] {white}Zombies {red}destroyed{white} a present!");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void HookCallback(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
UpdateMYSQL();
|
||||
{
|
||||
UpdateMYSQL();
|
||||
}
|
||||
|
||||
public bool UpdateMYSQL()
|
||||
{
|
||||
char error[255];
|
||||
Database db;
|
||||
Database db;
|
||||
if (SQL_CheckConfig("season"))
|
||||
{
|
||||
db = SQL_Connect("season", true, error, sizeof(error));
|
||||
}
|
||||
}
|
||||
if (db == null)
|
||||
{
|
||||
LogError("Could not connect to database: %s", error);
|
||||
@@ -450,23 +450,23 @@ public bool UpdateMYSQL()
|
||||
char sName[MAX_NAME_LENGTH];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
|
||||
GetClientName(client, sName, sizeof(sName));
|
||||
|
||||
|
||||
char sQuery[255];
|
||||
Format(sQuery, sizeof(sQuery), "SELECT collected FROM season_table WHERE steam_auth = '%s'", sSID);
|
||||
Format(sQuery, sizeof(sQuery), "SELECT collected FROM season_table WHERE steam_auth = '%s'", sSID);
|
||||
DBResultSet rs;
|
||||
if ((rs = SQL_Query(db, sQuery)) == null)
|
||||
{
|
||||
delete db;
|
||||
delete rs;
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
int iCollected;
|
||||
if (!(rs.RowCount > 0))
|
||||
{
|
||||
iCollected = 0;
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO season_table (steam_auth, name, collected) VALUES ('%s', '%s', '%d')", sSID, sName, iCollected);
|
||||
SQL_FastQuery(db, sQuery);
|
||||
SQL_FastQuery(db, sQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -483,13 +483,13 @@ public bool UpdateMYSQL()
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Your Team opened a present! You have collected {green}%d {white}presents so far.", iCollected);
|
||||
if (iCollected == GetConVarInt(g_hCVar_MilestoneInfection))
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Congratulations! You have unlocked {red}INFECTION EFFECTS{white}!");
|
||||
|
||||
|
||||
if (iCollected == GetConVarInt(g_hCVar_MilestoneGrenade))
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Congratulations! You have unlocked {red}GRENADE SKINS{white}!");
|
||||
|
||||
if (iCollected == GetConVarInt(g_hCVar_MilestoneSkin))
|
||||
CPrintToChat(client, "{green}[Unloze XMAS] {white}Congratulations! You have unlocked {red}XMAS SKINS{white}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
delete db;
|
||||
return true;
|
||||
@@ -499,32 +499,32 @@ public void CheckAndAddFlag(int client, int iCollected)
|
||||
{
|
||||
if (iCollected >= GetConVarInt(g_hCVar_MilestoneSkin))
|
||||
{
|
||||
AddUserFlags(client, Admin_Custom4);
|
||||
AddUserFlags(client, Admin_Custom4);
|
||||
}
|
||||
}
|
||||
|
||||
public int SpawnTrigger(int iHitbox)
|
||||
{
|
||||
char StrOutput1[128];
|
||||
char StrOutput1[128];
|
||||
Format(StrOutput1, sizeof(StrOutput1), "season_hitbox_%i,FireUser2,,0,1", iHitbox);
|
||||
|
||||
int Entity;
|
||||
|
||||
int Entity;
|
||||
// Spawn dynamic prop entity
|
||||
if ((Entity = CreateEntityByName("trigger_multiple")) == INVALID_ENT_REFERENCE)
|
||||
return -1;
|
||||
|
||||
|
||||
// Generate unique id for the entity
|
||||
char StrEntityName[64];
|
||||
char StrEntityName[64];
|
||||
Format(StrEntityName, sizeof(StrEntityName), "trigger_multiple_%i", Entity);
|
||||
|
||||
|
||||
// Setup entity
|
||||
DispatchKeyValue(Entity, "targetname", StrEntityName);
|
||||
DispatchKeyValue(Entity, "spawnflags", "1");
|
||||
DispatchKeyValue(Entity, "startdisabled", "1");
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
DispatchKeyValue(Entity, "OnUser1", StrOutput1);
|
||||
DispatchSpawn(Entity);
|
||||
ActivateEntity(Entity);
|
||||
ActivateEntity(Entity);
|
||||
|
||||
SetEntityModel(Entity, "models/zombieden/xmas/giftbox.mdl");
|
||||
float fMinbounds[3] = {-16.0, -16.0, -1.0};
|
||||
@@ -541,23 +541,23 @@ public int SpawnTrigger(int iHitbox)
|
||||
|
||||
public int SpawnRotating()
|
||||
{
|
||||
int Entity;
|
||||
int Entity;
|
||||
// Spawn dynamic prop entity
|
||||
if ((Entity = CreateEntityByName("func_rotating")) == INVALID_ENT_REFERENCE)
|
||||
return -1;
|
||||
|
||||
|
||||
// Generate unique id for the entity
|
||||
char StrEntityName[64];
|
||||
char StrEntityName[64];
|
||||
Format(StrEntityName, sizeof(StrEntityName), "season_rotating_%i", Entity);
|
||||
|
||||
|
||||
// Setup entity
|
||||
DispatchKeyValue(Entity, "targetname", StrEntityName);
|
||||
DispatchKeyValue(Entity, "maxspeed", "20");
|
||||
DispatchKeyValue(Entity, "spawnflags", "65");
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
DispatchSpawn(Entity);
|
||||
ActivateEntity(Entity);
|
||||
|
||||
ActivateEntity(Entity);
|
||||
|
||||
SetEntityModel(Entity, "models/zombieden/xmas/giftbox.mdl");
|
||||
float fMinbounds[3] = {-1.00, -1.00, -1.00};
|
||||
float fMaxbounds[3] = {1.00, 1.00, 1.00};
|
||||
@@ -576,7 +576,7 @@ public int SpawnProp()
|
||||
// Spawn dynamic prop entity
|
||||
if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
|
||||
return -1;
|
||||
|
||||
|
||||
// Setup entity
|
||||
DispatchKeyValue(Entity, "targetname", "season_prop");
|
||||
DispatchKeyValue(Entity, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
@@ -585,15 +585,15 @@ public int SpawnProp()
|
||||
DispatchKeyValue(Entity, "disablereceiveshadows", "1");
|
||||
DispatchKeyValue(Entity, "DisableBoneFollowers", "1");
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
|
||||
|
||||
DispatchSpawn(Entity);
|
||||
ActivateEntity(Entity);
|
||||
|
||||
int iRandomSkin = GetRandomInt(0, 1);
|
||||
|
||||
int iRandomSkin = GetRandomInt(0, 1);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
SetVariantString("0");
|
||||
}
|
||||
}
|
||||
else if (iRandomSkin == 1)
|
||||
{
|
||||
SetVariantString("1");
|
||||
@@ -608,49 +608,49 @@ public int SpawnParticle()
|
||||
// Spawn dynamic prop entity
|
||||
if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
|
||||
return -1;
|
||||
|
||||
|
||||
// Generate unique id for the entity
|
||||
char StrEntityName[64];
|
||||
char StrEntityName[64];
|
||||
Format(StrEntityName, sizeof(StrEntityName), "season_particle_%i", Entity);
|
||||
|
||||
|
||||
// Setup entity
|
||||
DispatchKeyValue(Entity, "targetname", StrEntityName);
|
||||
DispatchKeyValue(Entity, "effect_name", "achieved");
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
DispatchSpawn(Entity);
|
||||
ActivateEntity(Entity);
|
||||
ActivateEntity(Entity);
|
||||
return Entity;
|
||||
}
|
||||
|
||||
public int SpawnHitbox(int iRotatingParent, int iParticleParent)
|
||||
{
|
||||
char StrOutput1[128];
|
||||
char StrOutput1[128];
|
||||
Format(StrOutput1, sizeof(StrOutput1), "season_rotating_%i,KillHierarchy,,2.5,1", iRotatingParent);
|
||||
|
||||
char StrOutput2[128];
|
||||
|
||||
char StrOutput2[128];
|
||||
Format(StrOutput2, sizeof(StrOutput2), "season_particle_%i,Start,,0,1", iParticleParent);
|
||||
|
||||
char StrOutput3[128];
|
||||
|
||||
char StrOutput3[128];
|
||||
Format(StrOutput3, sizeof(StrOutput3), "season_rotating_%i,KillHierarchy,,59.0,1", iRotatingParent);
|
||||
|
||||
char StrOutput4[128];
|
||||
|
||||
char StrOutput4[128];
|
||||
Format(StrOutput4, sizeof(StrOutput4), "season_sound_hohohoho,Kill,,59.0,1");
|
||||
|
||||
char StrOutput5[128];
|
||||
|
||||
char StrOutput5[128];
|
||||
Format(StrOutput5, sizeof(StrOutput5), "season_rotating_%i,KillHierarchy,,0,1", iRotatingParent);
|
||||
|
||||
char StrOutput6[128];
|
||||
|
||||
char StrOutput6[128];
|
||||
Format(StrOutput6, sizeof(StrOutput6), "season_sound_hohohoho,Kill,,0,1");
|
||||
|
||||
|
||||
int Entity;
|
||||
// Spawn dynamic prop entity
|
||||
if ((Entity = CreateEntityByName("func_physbox_multiplayer")) == INVALID_ENT_REFERENCE)
|
||||
return -1;
|
||||
|
||||
|
||||
// Generate unique id for the entity
|
||||
char StrEntityName[64];
|
||||
char StrEntityName[64];
|
||||
Format(StrEntityName, sizeof(StrEntityName), "season_hitbox_%i", Entity);
|
||||
|
||||
|
||||
// Setup entity
|
||||
DispatchKeyValue(Entity, "targetname", StrEntityName);
|
||||
DispatchKeyValue(Entity, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
@@ -681,11 +681,11 @@ public int SpawnHitbox(int iRotatingParent, int iParticleParent)
|
||||
|
||||
public int SpawnAmbientHohohoho()
|
||||
{
|
||||
int Entity;
|
||||
int Entity;
|
||||
// Spawn dynamic prop entity
|
||||
if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
|
||||
return -1;
|
||||
|
||||
|
||||
// Setup entity
|
||||
DispatchKeyValue(Entity, "targetname", "season_sound_hohohoho");
|
||||
DispatchKeyValueVector(Entity, "origin", g_fPropOrigin);
|
||||
@@ -695,9 +695,9 @@ public int SpawnAmbientHohohoho()
|
||||
DispatchKeyValue(Entity, "volume", "10");
|
||||
DispatchKeyValue(Entity, "health", "10");
|
||||
DispatchKeyValue(Entity, "pitch", "100");
|
||||
DispatchKeyValue(Entity, "pitchstart", "100");
|
||||
DispatchKeyValue(Entity, "pitchstart", "100");
|
||||
DispatchSpawn(Entity);
|
||||
ActivateEntity(Entity);
|
||||
ActivateEntity(Entity);
|
||||
return Entity;
|
||||
}
|
||||
|
||||
@@ -707,30 +707,30 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
||||
{
|
||||
float fInfectionOrigin[3];
|
||||
GetClientAbsOrigin(client, fInfectionOrigin);
|
||||
|
||||
|
||||
int EntityProp;
|
||||
EntityProp = CreateEntityByName("prop_dynamic_override");
|
||||
EntityProp = CreateEntityByName("prop_dynamic_override");
|
||||
DispatchKeyValue(EntityProp, "targetname", "season_infection_prop");
|
||||
|
||||
int iRandomSkin = GetRandomInt(0, 4);
|
||||
|
||||
int iRandomSkin = GetRandomInt(0, 4);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
DispatchKeyValue(EntityProp, "model", "models/models_kit/xmas/xmastree_mini.mdl");
|
||||
DispatchKeyValue(EntityProp, "modelscale", "0.35");
|
||||
DispatchKeyValue(EntityProp, "angles", "0 0 0");
|
||||
}
|
||||
}
|
||||
else if (iRandomSkin == 1)
|
||||
{
|
||||
DispatchKeyValue(EntityProp, "model", "models/weapons/w_revenge_xmas_candy.mdl");
|
||||
DispatchKeyValue(EntityProp, "modelscale", "1.2");
|
||||
DispatchKeyValue(EntityProp, "angles", "-27 0 0");
|
||||
}
|
||||
}
|
||||
else if (iRandomSkin == 2)
|
||||
{
|
||||
DispatchKeyValue(EntityProp, "model", "models/johny-srka/snowman.mdl");
|
||||
DispatchKeyValue(EntityProp, "modelscale", "0.45");
|
||||
DispatchKeyValue(EntityProp, "angles", "0 0 0");
|
||||
}
|
||||
}
|
||||
else if (iRandomSkin == 3)
|
||||
{
|
||||
DispatchKeyValue(EntityProp, "model", "models/weapons/w_santa_hat_thrown.mdl");
|
||||
@@ -742,17 +742,17 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
||||
{
|
||||
DispatchKeyValue(EntityProp, "model", "models/models_kit/xmas/xmas_teddybear.mdl");
|
||||
DispatchKeyValue(EntityProp, "modelscale", "0.7");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DispatchKeyValue(EntityProp, "disableshadows", "1");
|
||||
DispatchKeyValue(EntityProp, "disablereceiveshadows", "1");
|
||||
DispatchKeyValue(EntityProp, "DisableBoneFollowers", "1");
|
||||
DispatchKeyValueVector(EntityProp, "origin", fInfectionOrigin);
|
||||
DispatchSpawn(EntityProp);
|
||||
ActivateEntity(EntityProp);
|
||||
|
||||
ActivateEntity(EntityProp);
|
||||
|
||||
int EntityRotating;
|
||||
EntityRotating = CreateEntityByName("func_rotating");
|
||||
EntityRotating = CreateEntityByName("func_rotating");
|
||||
DispatchKeyValue(EntityRotating, "targetname", "season_infection_rotating");
|
||||
DispatchKeyValue(EntityRotating, "maxspeed", "13");
|
||||
DispatchKeyValue(EntityRotating, "spawnflags", "65");
|
||||
@@ -760,8 +760,8 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
||||
DispatchKeyValue(EntityRotating, "OnUser1", "!self,KillHierarchy,,45,1");
|
||||
DispatchKeyValue(EntityRotating, "OnUser2", "!self,KillHierarchy,,0,1");
|
||||
DispatchSpawn(EntityRotating);
|
||||
ActivateEntity(EntityRotating);
|
||||
|
||||
ActivateEntity(EntityRotating);
|
||||
|
||||
SetEntityModel(EntityRotating, "models/models_kit/xmas/xmastree_mini.mdl");
|
||||
float fMinbounds[3] = {-1.00, -1.00, -1.00};
|
||||
float fMaxbounds[3] = {1.00, 1.00, 1.00};
|
||||
@@ -771,17 +771,17 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
||||
int enteffects = GetEntProp(EntityRotating, Prop_Send, "m_fEffects");
|
||||
enteffects |= 32;
|
||||
SetEntProp(EntityRotating, Prop_Send, "m_fEffects", enteffects);
|
||||
|
||||
|
||||
SetVariantString("!activator");
|
||||
AcceptEntityInput(EntityProp, "SetParent", EntityRotating);
|
||||
AcceptEntityInput(EntityRotating, "FireUser1");
|
||||
|
||||
int iEntityLimit = GetConVarInt(g_hCVar_EntityLimit);
|
||||
|
||||
int iEntityLimit = GetConVarInt(g_hCVar_EntityLimit);
|
||||
if ((EntityRotating > iEntityLimit) || (EntityProp > iEntityLimit))
|
||||
{
|
||||
AcceptEntityInput(EntityRotating, "FireUser2");
|
||||
CPrintToChatAll("{green}[Unloze XMAS] {white}Infection Effect removed due to {red}critical amount of entities{white}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,33 +794,33 @@ public void OnEntityCreated(int entity, const char[] classname)
|
||||
|
||||
public void ProjectileSpawned(int Entity)
|
||||
{
|
||||
int iOwner = GetEntPropEnt(Entity, Prop_Data, "m_hOwnerEntity");
|
||||
int iOwner = GetEntPropEnt(Entity, Prop_Data, "m_hOwnerEntity");
|
||||
if(0 < iOwner <= MaxClients && IsClientInGame(iOwner))
|
||||
{
|
||||
if (CheckMYSQL(iOwner) >= GetConVarInt(g_hCVar_MilestoneGrenade))
|
||||
{
|
||||
int iRandomSkin = GetRandomInt(0, 3);
|
||||
{
|
||||
int iRandomSkin = GetRandomInt(0, 3);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
SetEntityModel(Entity, "models/weapons/w_snowball_thrown.mdl");
|
||||
SetVariantString("modelscale 3.0");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
}
|
||||
}
|
||||
else if (iRandomSkin == 1)
|
||||
{
|
||||
SetEntityModel(Entity, "models/zombieden/xmas/giftbox.mdl");
|
||||
SetVariantString("modelscale 0.6");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
iRandomSkin = GetRandomInt(0, 1);
|
||||
iRandomSkin = GetRandomInt(0, 1);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
SetVariantString("0");
|
||||
}
|
||||
}
|
||||
else if (iRandomSkin == 1)
|
||||
{
|
||||
SetVariantString("1");
|
||||
}
|
||||
AcceptEntityInput(Entity, "Skin");
|
||||
AcceptEntityInput(Entity, "Skin");
|
||||
}
|
||||
else if (iRandomSkin == 2)
|
||||
{
|
||||
@@ -835,7 +835,7 @@ public void ProjectileSpawned(int Entity)
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int IsValidClient(int client, bool nobots = true)
|
||||
|
||||
Reference in New Issue
Block a user