Merge branch 'master' of http://git.unloze.com/UNLOZE/sm-plugins
This commit is contained in:
commit
9034d4284a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -65,6 +65,7 @@ public void OnPluginStart()
|
||||
HookEvent("round_start", OnRoundStart, EventHookMode_Post);
|
||||
|
||||
RegConsoleCmd("sm_pumpkins", Command_Collected, "Shows the total amount of Pumpkins you have collected so far");
|
||||
RegConsoleCmd("sm_pumpkin", Command_Collected, "Shows the total amount of Pumpkins you have collected so far");
|
||||
RegConsoleCmd("sm_halloween", Command_Collected, "Shows the total amount of Pumpkins you have collected so far");
|
||||
RegConsoleCmd("sm_highscore", Command_HighScore, "Shows the Pumpkin HighScore");
|
||||
|
||||
@ -100,19 +101,19 @@ public void OnMapStart()
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/thorn/headlight.vmt");
|
||||
PrecacheModel("models/player/techknow/thorn/thorn.mdl");
|
||||
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim.mdl");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim.phy");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim.sw.vtx");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim.vvd");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim_unloze.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim_unloze.dx90.vtx");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim_unloze.mdl");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim_unloze.phy");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim_unloze.sw.vtx");
|
||||
AddFileToDownloadsTable("models/player/techknow/grimreaper/grim_unloze.vvd");
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/grimreaper/grim.vmt");
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/grimreaper/grim.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/grimreaper/grim_n.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/grimreaper/grim2.vmt");
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/grimreaper/grim2.vtf");
|
||||
AddFileToDownloadsTable("materials/models/player/techknow/grimreaper/grim2_n.vtf");
|
||||
PrecacheModel("models/player/techknow/grimreaper/grim.mdl");
|
||||
PrecacheModel("models/player/techknow/grimreaper/grim_unloze.mdl");
|
||||
|
||||
AddFileToDownloadsTable("models/player/microsoft/skeleton.dx80.vtx");
|
||||
AddFileToDownloadsTable("models/player/microsoft/skeleton.dx90.vtx");
|
||||
@ -455,6 +456,10 @@ public Action SpawnCollectable(Handle timer)
|
||||
return;
|
||||
|
||||
int iTarget = GetTargetClient();
|
||||
|
||||
if (!IsValidClient(iTarget, false))
|
||||
return;
|
||||
|
||||
float fOrigin[3];
|
||||
float fTempOrigin[3];
|
||||
GetClientAbsOrigin(iTarget, fOrigin);
|
||||
@ -619,46 +624,14 @@ public void HookCallback(const char[] output, int caller, int activator, float d
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
char sQuery[255];
|
||||
Format(sQuery, sizeof(sQuery), "SELECT collected FROM halloween_table WHERE steam_auth = '%s'", sSteamID);
|
||||
SQL_TQuery(g_hDatabase, TQueryCBUpdate, sQuery, GetClientUserId(client));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 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);
|
||||
char sQuery[255];
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO halloween_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;
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE halloween_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 halloween_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, "{darkorange}[UNLOZE HALLOWEEN] {white}Your Team found a pumpkin! You have collected {green}%d {white}pumpkins so far.", g_iCollected[client]);
|
||||
@ -671,7 +644,12 @@ public void TQueryCBUpdate(Handle owner, Handle rs, const char[] error, any data
|
||||
if (g_iCollected[client] == g_hCVar_MilestoneSkin.IntValue)
|
||||
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}HALLOWEEN SKINS{white}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
|
||||
{
|
||||
if (!IsValidClient(attacker))
|
||||
@ -794,6 +772,9 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnEntityCreated(int entity, const char[] classname)
|
||||
{
|
||||
if (StrContains(classname, "_projectile", false) != -1)
|
||||
@ -801,6 +782,9 @@ public void OnEntityCreated(int entity, const char[] classname)
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void ProjectileSpawned(int Entity)
|
||||
{
|
||||
int iOwner = GetEntPropEnt(Entity, Prop_Data, "m_hOwnerEntity");
|
||||
@ -809,13 +793,22 @@ public void ProjectileSpawned(int Entity)
|
||||
|
||||
if (g_iCollected[iOwner] >= g_hCVar_MilestoneGrenade.IntValue)
|
||||
{
|
||||
int iRandomSkin = GetRandomInt(0, 0);
|
||||
if (iRandomSkin == 0)
|
||||
{
|
||||
SetEntityModel(Entity, "models/models_kit/hallo_pumpkin_l.mdl");
|
||||
SetVariantString("modelscale 0.35");
|
||||
AcceptEntityInput(Entity, "AddOutput");
|
||||
}
|
||||
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, "model", "models/models_kit/hallo_pumpkin_l.mdl");
|
||||
DispatchKeyFormat(iNadeProp, "disableshadows", "1");
|
||||
DispatchKeyFormat(iNadeProp, "disablereceiveshadows", "1");
|
||||
DispatchKeyFormat(iNadeProp, "DisableBoneFollowers", "1");
|
||||
DispatchKeyFormat(iNadeProp, "modelscale", "0.35");
|
||||
|
||||
SpawnAndActivate(iNadeProp);
|
||||
ParentToEntity(iNadeProp, Entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,6 +479,10 @@ public Action SpawnCollectable(Handle timer)
|
||||
return;
|
||||
|
||||
int iTarget = GetTargetClient();
|
||||
|
||||
if (!IsValidClient(iTarget, false))
|
||||
return;
|
||||
|
||||
float fOrigin[3];
|
||||
GetClientAbsOrigin(iTarget, fOrigin);
|
||||
|
||||
@ -562,12 +568,12 @@ public Action SpawnCollectable(Handle timer)
|
||||
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,46 +643,14 @@ public void HookCallback(const char[] output, int caller, int activator, float d
|
||||
char sSteamID[32];
|
||||
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 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);
|
||||
char sQuery[255];
|
||||
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;
|
||||
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]);
|
||||
@ -689,15 +663,19 @@ public void TQueryCBUpdate(Handle owner, Handle rs, const char[] error, any data
|
||||
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);
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user