season: updating some stuff

This commit is contained in:
neon
2018-11-28 12:44:34 +01:00
parent cc9d8e52cd
commit eadbf8b6cc
13 changed files with 123 additions and 143 deletions
+54 -61
View File
@@ -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,15 +456,19 @@ public Action SpawnCollectable(Handle timer)
return;
int iTarget = GetTargetClient();
if (!IsValidClient(iTarget, false))
return;
float fOrigin[3];
float fTempOrigin[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.
@@ -619,9 +624,25 @@ 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 halloween_table WHERE steam_auth = '%s'", sSteamID);
SQL_TQuery(g_hDatabase, TQueryCBUpdate, sQuery, GetClientUserId(client));
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;
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]);
if (g_iCollected[client] == g_hCVar_MilestoneInfection.IntValue)
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}INFECTION EFFECTS{white}!");
if (g_iCollected[client] == g_hCVar_MilestoneGrenade.IntValue)
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}GRENADE SKINS{white}!");
if (g_iCollected[client] == g_hCVar_MilestoneSkin.IntValue)
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}HALLOWEEN SKINS{white}!");
}
}
}
@@ -629,49 +650,6 @@ public void HookCallback(const char[] output, int caller, int activator, float d
//----------------------------------------------------------------------------------------------------
// 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 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]);
if (g_iCollected[client] == g_hCVar_MilestoneInfection.IntValue)
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}INFECTION EFFECTS{white}!");
if (g_iCollected[client] == g_hCVar_MilestoneGrenade.IntValue)
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}GRENADE SKINS{white}!");
if (g_iCollected[client] == g_hCVar_MilestoneSkin.IntValue)
CPrintToChat(client, "{darkorange}[UNLOZE HALLOWEEN] {white}Congratulations! You have unlocked {red}HALLOWEEN SKINS{white}!");
}
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);
}
}