forked from UNLOZE/sm-plugins
season: updating some stuff
This commit is contained in:
@@ -65,6 +65,7 @@ public void OnPluginStart()
|
||||
HookEvent("round_start", OnRoundStart, EventHookMode_Post);
|
||||
|
||||
RegConsoleCmd("sm_presents", Command_Collected, "Shows the total amount of Presents you have collected so far");
|
||||
RegConsoleCmd("sm_xmas", Command_Collected, "Shows the total amount of Presents you have collected so far");
|
||||
RegConsoleCmd("sm_highscore", Command_HighScore, "Shows the Present HighScore");
|
||||
|
||||
AutoExecConfig();
|
||||
@@ -236,6 +237,7 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("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);
|
||||
}
|
||||
@@ -477,14 +479,18 @@ public Action SpawnCollectable(Handle timer)
|
||||
return;
|
||||
|
||||
int iTarget = GetTargetClient();
|
||||
|
||||
if (!IsValidClient(iTarget, false))
|
||||
return;
|
||||
|
||||
float fOrigin[3];
|
||||
GetClientAbsOrigin(iTarget, fOrigin);
|
||||
|
||||
// Rotating
|
||||
int iRotating = CreateEntityAtOrigin("func_rotating", fOrigin);
|
||||
DispatchKeyFormat(iRotating, "targetname", "season_rotating_%d", g_iCounter);
|
||||
DispatchKeyFormat(iRotating, "targetname", "season_rotating_%d", g_iCounter);
|
||||
DispatchKeyFormat(iRotating, "maxspeed", "20");
|
||||
DispatchKeyFormat(iRotating, "spawnflags", "65");
|
||||
DispatchKeyFormat(iRotating, "spawnflags", "65");
|
||||
SpawnAndActivate(iRotating);
|
||||
|
||||
// make the trigger work.
|
||||
@@ -495,7 +501,7 @@ public Action SpawnCollectable(Handle timer)
|
||||
// Model
|
||||
int iModel = CreateEntityAtOrigin("prop_dynamic_override", fOrigin);
|
||||
DispatchKeyFormat(iModel, "targetname", "season_prop_%d", g_iCounter);
|
||||
DispatchKeyFormat(iModel, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
DispatchKeyFormat(iModel, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
DispatchKeyFormat(iModel, "modelscale", "0.8");
|
||||
DispatchKeyFormat(iModel, "disablebonefollowers", "1");
|
||||
SpawnAndActivate(iModel);
|
||||
@@ -519,9 +525,9 @@ public Action SpawnCollectable(Handle timer)
|
||||
|
||||
// Trigger
|
||||
int iTrigger = CreateEntityAtOrigin("trigger_multiple", fOrigin);
|
||||
DispatchKeyFormat(iTrigger, "targetname", "season_trigger_%d", g_iCounter);
|
||||
DispatchKeyFormat(iTrigger, "spawnflags", "1");
|
||||
DispatchKeyFormat(iTrigger, "startdisabled", "1");
|
||||
DispatchKeyFormat(iTrigger, "targetname", "season_trigger_%d", g_iCounter);
|
||||
DispatchKeyFormat(iTrigger, "spawnflags", "1");
|
||||
DispatchKeyFormat(iTrigger, "startdisabled", "1");
|
||||
DispatchKeyFormat(iTrigger, "OnUser1", "season_hitbox_%d,FireUser2,,0,1", g_iCounter);
|
||||
SpawnAndActivate(iTrigger);
|
||||
ParentToEntity(iTrigger, iRotating);
|
||||
@@ -550,24 +556,24 @@ public Action SpawnCollectable(Handle timer)
|
||||
// Hitbox
|
||||
int iHitbox = CreateEntityAtOrigin("func_physbox_multiplayer", fOrigin);
|
||||
DispatchKeyFormat(iHitbox, "targetname", "season_hitbox_%d", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
DispatchKeyFormat(iHitbox, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
DispatchKeyFormat(iHitbox, "modelscale", "0.8");
|
||||
DispatchKeyFormat(iHitbox, "disableshadows", "1");
|
||||
DispatchKeyFormat(iHitbox, "disablereceiveshadows", "1");
|
||||
DispatchKeyFormat(iHitbox, "DisableBoneFollowers", "1");
|
||||
DispatchKeyFormat(iHitbox, "disablereceiveshadows", "1");
|
||||
DispatchKeyFormat(iHitbox, "DisableBoneFollowers", "1");
|
||||
DispatchKeyFormat(iHitbox, "rendermode", "10");
|
||||
DispatchKeyFormat(iHitbox, "PerformanceMode", "1");
|
||||
DispatchKeyFormat(iHitbox, "material", "3");
|
||||
DispatchKeyFormat(iHitbox, "material", "3");
|
||||
DispatchKeyFormat(iHitbox, "health", "200");
|
||||
DispatchKeyFormat(iHitbox, "physdamagescale", "1.0");
|
||||
DispatchKeyFormat(iHitbox, "OnBreak", "season_rotating_%d,KillHierarchy,,2.5,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnBreak", "season_particle_%d,Start,,0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnBreak", "season_sound_%d,Start,PlaySound,,0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnBreak", "season_sound_%d,Start,Kill,,2.4,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnBreak", "season_sound_%d,PlaySound,,0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnBreak", "season_sound_%d,Kill,,2.4,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnUser1", "season_rotating_%d,KillHierarchy,,59.0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnUser1", "season_sound_%d,Start,Kill,,59.0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnUser1", "season_sound_%d,Kill,,59.0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnUser2", "season_rotating_%d,KillHierarchy,,0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnUser2", "season_sound_%d,Start,Kill,,0,1", g_iCounter);
|
||||
DispatchKeyFormat(iHitbox, "OnUser2", "season_sound_%d,Kill,,0,1", g_iCounter);
|
||||
SpawnAndActivate(iHitbox);
|
||||
ParentToEntity(iHitbox, iRotating);
|
||||
|
||||
@@ -637,74 +643,46 @@ public void HookCallback(const char[] output, int caller, int activator, float d
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
char sName[MAX_NAME_LENGTH];
|
||||
GetClientName(client, sName, sizeof(sName));
|
||||
|
||||
char sQuery[255];
|
||||
Format(sQuery, sizeof(sQuery), "SELECT collected FROM xmas_table WHERE steam_auth = '%s'", sSteamID);
|
||||
SQL_TQuery(g_hDatabase, TQueryCBUpdate, sQuery, GetClientUserId(client));
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO xmas_table (steam_auth,name,collected) VALUES ('%s','%s',1) ON DUPLICATE KEY UPDATE collected=collected+1;", sSteamID, sName);
|
||||
SQL_FastQuery(g_hDatabase, sQuery);
|
||||
|
||||
g_iCollected[client] += 1;
|
||||
CheckAndAddFlag(client);
|
||||
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Your Team opened a present! You have collected {green}%d {white}presents so far.", g_iCollected[client]);
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneInfection.IntValue)
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Congratulations! You have unlocked {red}INFECTION EFFECTS{white}!");
|
||||
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneGrenade.IntValue)
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Congratulations! You have unlocked {red}GRENADE SKINS{white}!");
|
||||
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneSkin.IntValue)
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Congratulations! You have unlocked {red}XMAS SKINS{white}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void TQueryCBUpdate(Handle owner, Handle rs, const char[] error, any data)
|
||||
{
|
||||
int client = 0;
|
||||
|
||||
if ((client = GetClientOfUserId(data)) == 0)
|
||||
return;
|
||||
|
||||
char sQuery[255];
|
||||
char sName[MAX_NAME_LENGTH];
|
||||
GetClientName(client, sName, sizeof(sName));
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
if (SQL_GetRowCount(rs) > 0)
|
||||
{
|
||||
int iField;
|
||||
SQL_FetchRow(rs);
|
||||
SQL_FieldNameToNum(rs, "collected", iField);
|
||||
g_iCollected[client] = SQL_FetchInt(rs, iField);
|
||||
g_iCollected[client] += 1;
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE xmas_table SET name='%s', collected='%d' WHERE steam_auth='%s'", sName, g_iCollected[client], sSteamID);
|
||||
SQL_FastQuery(g_hDatabase, sQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO xmas_table (steam_auth, name, collected) VALUES ('%s', '%s', '%d')", sSteamID, sName, 1);
|
||||
SQL_FastQuery(g_hDatabase, sQuery);
|
||||
g_iCollected[client] = 1;
|
||||
}
|
||||
delete rs;
|
||||
CheckAndAddFlag(client);
|
||||
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Your Team opened a present! You have collected {green}%d {white}presents so far.", g_iCollected[client]);
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneInfection.IntValue)
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Congratulations! You have unlocked {red}INFECTION EFFECTS{white}!");
|
||||
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneGrenade.IntValue)
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Congratulations! You have unlocked {red}GRENADE SKINS{white}!");
|
||||
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneSkin.IntValue)
|
||||
CPrintToChat(client, "{green}[UNLOZE XMAS] {white}Congratulations! You have unlocked {red}XMAS SKINS{white}!");
|
||||
}
|
||||
|
||||
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
|
||||
{
|
||||
if (!IsValidClient(attacker))
|
||||
return;
|
||||
|
||||
if (g_hCVar_InfectionEffectEnabled.BoolValue && ((g_iCollected[client] >= g_hCVar_MilestoneInfection.IntValue) || g_iCollected[attacker] >= g_hCVar_MilestoneInfection.IntValue))
|
||||
{
|
||||
float fInfectionOrigin[3];
|
||||
GetClientAbsOrigin(client, fInfectionOrigin);
|
||||
|
||||
|
||||
// Rotating
|
||||
int iRotating = CreateEntityAtOrigin("func_rotating", fInfectionOrigin);
|
||||
DispatchKeyFormat(iRotating, "targetname", "season_infection_rotating_%d", g_iCounter);
|
||||
DispatchKeyFormat(iRotating, "maxspeed", "13");
|
||||
DispatchKeyFormat(iRotating, "maxspeed", "13");
|
||||
DispatchKeyFormat(iRotating, "spawnflags", "65");
|
||||
DispatchKeyFormat(iRotating, "OnUser1", "!self,KillHierarchy,,45,1");
|
||||
DispatchKeyFormat(iRotating, "OnUser2", "!self,KillHierarchy,,0,1");
|
||||
DispatchKeyFormat(iRotating, "OnUser1", "!self,KillHierarchy,,45,1");
|
||||
DispatchKeyFormat(iRotating, "OnUser2", "!self,KillHierarchy,,0,1");
|
||||
SpawnAndActivate(iRotating);
|
||||
|
||||
// make the trigger work.
|
||||
@@ -751,7 +729,7 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
||||
|
||||
DispatchKeyFormat(iModel, "disableshadows", "1");
|
||||
DispatchKeyFormat(iModel, "disablereceiveshadows", "1");
|
||||
DispatchKeyFormat(iModel, "DisableBoneFollowers", "1");
|
||||
DispatchKeyFormat(iModel, "DisableBoneFollowers", "1");
|
||||
DispatchKeyValueVector(iModel, "origin", fInfectionOrigin);
|
||||
SpawnAndActivate(iModel);
|
||||
ParentToEntity(iModel, iRotating);
|
||||
@@ -784,41 +762,50 @@ public void ProjectileSpawned(int Entity)
|
||||
|
||||
if (g_iCollected[iOwner] >= g_hCVar_MilestoneGrenade.IntValue)
|
||||
{
|
||||
SetEntityRenderMode(Entity, RENDER_NONE);
|
||||
|
||||
float fNadeOrigin[3];
|
||||
GetEntPropVector(Entity, Prop_Send, "m_vecOrigin", fNadeOrigin);
|
||||
|
||||
int iNadeProp = CreateEntityAtOrigin("prop_dynamic_override", fNadeOrigin);
|
||||
DispatchKeyFormat(iNadeProp, "targetname", "season_nade_prop_%d", g_iCounter);
|
||||
DispatchKeyFormat(iNadeProp, "disableshadows", "1");
|
||||
DispatchKeyFormat(iNadeProp, "disablereceiveshadows", "1");
|
||||
DispatchKeyFormat(iNadeProp, "DisableBoneFollowers", "1");
|
||||
|
||||
int iRandomSkin = GetRandomInt(0, 3);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
SetEntityModel(Entity, "models/weapons/w_snowball_thrown.mdl");
|
||||
SetVariantString("modelscale 3.0");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
DispatchKeyFormat(iNadeProp, "model", "models/weapons/w_snowball_thrown.mdl");
|
||||
DispatchKeyFormat(iNadeProp, "modelscale", "3.0");
|
||||
}
|
||||
else if (iRandomSkin == 1)
|
||||
{
|
||||
SetEntityModel(Entity, "models/zombieden/xmas/giftbox.mdl");
|
||||
SetVariantString("modelscale 0.6");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
DispatchKeyFormat(iNadeProp, "model", "models/zombieden/xmas/giftbox.mdl");
|
||||
DispatchKeyFormat(iNadeProp, "modelscale", "0.6");
|
||||
iRandomSkin = GetRandomInt(0, 1);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
SetVariantString("0");
|
||||
DispatchKeyFormat(iNadeProp, "skin", "0");
|
||||
}
|
||||
else if (iRandomSkin == 1)
|
||||
{
|
||||
SetVariantString("1");
|
||||
DispatchKeyFormat(iNadeProp, "skin", "1");
|
||||
}
|
||||
AcceptEntityInput(Entity, "Skin");
|
||||
}
|
||||
else if (iRandomSkin == 2)
|
||||
{
|
||||
SetEntityModel(Entity, "models/weapons/w_ornament_thrown.mdl");
|
||||
SetVariantString("modelscale 2.0");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
DispatchKeyFormat(iNadeProp, "model", "models/weapons/w_ornament_thrown.mdl");
|
||||
DispatchKeyFormat(iNadeProp, "modelscale", "2.0");
|
||||
}
|
||||
else if (iRandomSkin == 3)
|
||||
{
|
||||
SetEntityModel(Entity, "models/weapons/w_santa_hat_thrown.mdl");
|
||||
SetVariantString("modelscale 2.3");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
DispatchKeyFormat(iNadeProp, "model", "models/weapons/w_santa_hat_thrown.mdl");
|
||||
DispatchKeyFormat(iNadeProp, "modelscale", "2.3");
|
||||
}
|
||||
|
||||
SpawnAndActivate(iNadeProp);
|
||||
ParentToEntity(iNadeProp, Entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user