Vortigaunt: adding this useful plugins, which definetly is not aboose!

This commit is contained in:
neon 2018-07-29 02:39:53 +02:00
parent 41dc3ba6f8
commit 6428e90e81

View File

@ -0,0 +1,306 @@
#include <sourcemod>
#include <sdktools>
#include <morecolors.inc>
#pragma semicolon 1
#pragma newdecls required
int g_iCounter = 0;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Plugin myinfo =
{
name = "Vortigaunt",
author = "Neon",
description = "Spawn Vortigaunts on every map",
version = "1.0",
url = "https://steamcommunity.com/id/n3ontm"
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
HookEvent("round_start", OnRoundStart, EventHookMode_Post);
RegAdminCmd("sm_vortigaunt", Command_Vortigaunt, ADMFLAG_RCON);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
PrecacheModel("models/vortigaunt_slave.mdl");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_iCounter = 0;
// Human filter
int iHumanFilter = CreateEntityByName("filter_activator_team");
DispatchKeyValue(iHumanFilter, "targetname", "vort_human_filter");
DispatchKeyValue(iHumanFilter, "Negated", "0");
DispatchKeyValue(iHumanFilter, "filterteam", "3");
DispatchSpawn(iHumanFilter);
ActivateEntity(iHumanFilter);
// Zombie filter
int iZombieFilter = CreateEntityByName("filter_activator_team");
DispatchKeyValue(iZombieFilter, "targetname", "vort_zombie_filter");
DispatchKeyValue(iZombieFilter, "Negated", "0");
DispatchKeyValue(iZombieFilter, "filterteam", "2");
DispatchSpawn(iZombieFilter);
ActivateEntity(iZombieFilter);
// player_weaponstrip
int iWeaponStrip = CreateEntityByName("player_weaponstrip");
DispatchKeyValue(iWeaponStrip, "targetname", "vort_weaponstrip");
DispatchSpawn(iWeaponStrip);
ActivateEntity(iWeaponStrip);
// speedmod
int iSpeedMod = CreateEntityByName("player_speedmod");
DispatchKeyValue(iSpeedMod, "targetname", "vort_speed");
DispatchSpawn(iSpeedMod);
ActivateEntity(iSpeedMod);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_Vortigaunt(int client, int args)
{
float fOrigin[3];
GetClientEyePosition(client, fOrigin);
SpawnVortigaunt(fOrigin);
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void SpawnVortigaunt(float fOrigin[3])
{
char sBuffer[256];
float fOriginTemp[3];
// Knife
int iKnife = CreateEntityByName("weapon_knife");
Format(sBuffer, sizeof(sBuffer), "vort_knife_%d", g_iCounter);
DispatchKeyValue(iKnife, "targetname", sBuffer);
Format(sBuffer, sizeof(sBuffer), "11051995%d", g_iCounter);
DispatchKeyValue(iKnife, "hammerid", sBuffer);
DispatchKeyValue(iKnife, "spawnflags", "1");
DispatchKeyValue(iKnife, "angles", "0 0 0");
DispatchKeyValueVector(iKnife, "origin", fOrigin);
DispatchKeyValue(iKnife, "OnPlayerPickUp", "!activator,AddOutput,renderfx 6,0,-1");
Format(sBuffer, sizeof(sBuffer), "vort_knife_%d,AddOutput,renderfx 6,0.03,-1", g_iCounter);
DispatchKeyValue(iKnife, "OnPlayerPickup", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_ui_%d,Activate,,0,-1", g_iCounter);
DispatchKeyValue(iKnife, "OnPlayerPickup", sBuffer);
DispatchSpawn(iKnife);
ActivateEntity(iKnife);
HookSingleEntityOutput(iKnife, "OnPlayerPickup", VortigauntPickup, false);
// Model
int iModel = CreateEntityByName("prop_dynamic");
Format(sBuffer, sizeof(sBuffer), "vort_model_%d", g_iCounter);
DispatchKeyValue(iModel, "targetname", sBuffer);
DispatchKeyValue(iModel, "model", "models/vortigaunt_slave.mdl");
DispatchKeyValue(iModel, "DisableBoneFollowers", "1");
DispatchKeyValue(iModel, "DefaultAnim", "Run_all");
fOriginTemp[0] = fOrigin[0] + 7.0;
fOriginTemp[1] = fOrigin[1] - 0.0;
fOriginTemp[2] = fOrigin[2] - 34.24;
DispatchKeyValueVector(iModel, "origin", fOriginTemp);
DispatchSpawn(iModel);
ActivateEntity(iModel);
// pickup trigger_once
int iTrigger = CreateEntityByName("trigger_once");
Format(sBuffer, sizeof(sBuffer), "vort_trigger_%d", g_iCounter);
DispatchKeyValue(iTrigger, "targetname", sBuffer);
DispatchKeyValue(iTrigger, "spawnflags", "1");
DispatchKeyValue(iTrigger, "startdisabled", "1");
DispatchKeyValue(iTrigger, "filtername", "vort_zombie_filter");
DispatchKeyValue(iTrigger, "OnStartTouch", "vort_weaponstrip,StripWeaponsAndSuit,,0,-1");
DispatchKeyValueVector(iTrigger, "origin", fOrigin);
DispatchSpawn(iTrigger);
ActivateEntity(iTrigger);
SetEntityModel(iTrigger, "models/vortigaunt_slave.mdl");
float fMinbounds[3] = {-10.0, -10.0, -36.0};
float fMaxbounds[3] = {10.0, 10.0, 36.0};
SetEntPropVector(iTrigger, Prop_Send, "m_vecMins", fMinbounds);
SetEntPropVector(iTrigger, Prop_Send, "m_vecMaxs", fMaxbounds);
SetEntProp(iTrigger, Prop_Send, "m_nSolidType", 2);
int enteffects = GetEntProp(iTrigger, Prop_Send, "m_fEffects");
enteffects |= 32;
SetEntProp(iTrigger, Prop_Send, "m_fEffects", enteffects);
// Sound
int iSound = CreateEntityByName("ambient_generic");
Format(sBuffer, sizeof(sBuffer), "vort_sound_%d", g_iCounter);
DispatchKeyValue(iSound, "targetname", sBuffer);
DispatchKeyValue(iSound, "spawnflags", "48");
DispatchKeyValue(iSound, "radius", "2250");
Format(sBuffer, sizeof(sBuffer), "vort_knife_%d", g_iCounter);
DispatchKeyValue(iSound, "SourceEntityName", sBuffer);
DispatchKeyValue(iSound, "message", "ambient/energy/zap9.wav");
DispatchKeyValue(iSound, "volume", "10");
DispatchKeyValue(iSound, "health", "10");
DispatchKeyValue(iSound, "pitch", "100");
DispatchKeyValue(iSound, "pitchstart", "100");
DispatchSpawn(iSound);
ActivateEntity(iSound);
// Push
int iPush = CreateEntityByName("trigger_push");
Format(sBuffer, sizeof(sBuffer), "vort_push_%d", g_iCounter);
DispatchKeyValue(iPush, "targetname", sBuffer);
DispatchKeyValue(iPush, "spawnflags", "1");
DispatchKeyValue(iPush, "startdisabled", "1");
DispatchKeyValue(iPush, "speed", "1800");
DispatchKeyValue(iPush, "pushdir", "0 180 0");
DispatchKeyValue(iPush, "filtername", "vort_human_filter");
fOriginTemp[0] = fOrigin[0] + 899.0;
fOriginTemp[1] = fOrigin[1] - 0.0;
fOriginTemp[2] = fOrigin[2] - 8.0;
DispatchKeyValueVector(iPush, "origin", fOriginTemp);
DispatchSpawn(iPush);
ActivateEntity(iPush);
SetEntityModel(iPush, "models/vortigaunt_slave.mdl");
float fMinbounds2[3] = {-852.0, -16.0, -9.0};
float fMaxbounds2[3] = {852.0, 16.0, 17.0};
SetEntPropVector(iPush, Prop_Send, "m_vecMins", fMinbounds2);
SetEntPropVector(iPush, Prop_Send, "m_vecMaxs", fMaxbounds2);
SetEntProp(iPush, Prop_Send, "m_nSolidType", 3);
int enteffects2 = GetEntProp(iPush, Prop_Send, "m_fEffects");
enteffects2 |= 32;
SetEntProp(iPush, Prop_Send, "m_fEffects", enteffects2);
// Relay
int iRelay = CreateEntityByName("logic_relay");
Format(sBuffer, sizeof(sBuffer), "vort_relay_%d", g_iCounter);
DispatchKeyValueVector(iRelay, "origin", fOrigin);
DispatchKeyValue(iRelay, "targetname", sBuffer);
DispatchKeyValue(iRelay, "spawnflags", "0");
DispatchKeyValue(iRelay, "startdisabled", "0");
DispatchKeyValue(iRelay, "OnTrigger", "!self,Disable,,0,-1");
DispatchKeyValue(iRelay, "OnTrigger", "!self,Enable,,4,-1");
Format(sBuffer, sizeof(sBuffer), "vort_model_%d,SetAnimation,zapattack1,0,-1", g_iCounter);
DispatchKeyValue(iRelay, "OnTrigger", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_push_%d,Enable,,1.5,-1", g_iCounter);
DispatchKeyValue(iRelay, "OnTrigger", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_push_%d,Disable,,2,-1", g_iCounter);
DispatchKeyValue(iRelay, "OnTrigger", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_sound_%d,PlaySound,,1.5,-1", g_iCounter);
DispatchKeyValue(iRelay, "OnTrigger", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_beam_%d,TurnOn,,1.5,-1", g_iCounter);
DispatchKeyValue(iRelay, "OnTrigger", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_beam_%d,TurnOff,,2.5,-1", g_iCounter);
DispatchKeyValue(iRelay, "OnTrigger", sBuffer);
DispatchSpawn(iRelay);
ActivateEntity(iRelay);
// Game UI
int iUI = CreateEntityByName("game_ui");
Format(sBuffer, sizeof(sBuffer), "vort_ui_%d", g_iCounter);
DispatchKeyValue(iUI, "targetname", sBuffer);
DispatchKeyValue(iUI, "spawnflags", "0");
DispatchKeyValue(iUI, "FieldOfView", "-1.0");
DispatchKeyValue(iUI, "PressedAttack2", "vort_speed,ModifySpeed,0,0,-1");
DispatchKeyValue(iUI, "PressedAttack2", "vort_speed,ModifySpeed,1.15,3.25,-1");
Format(sBuffer, sizeof(sBuffer), "vort_relay_%d,Trigger,,0,-1", g_iCounter);
DispatchKeyValue(iUI, "PressedAttack2", sBuffer);
DispatchSpawn(iUI);
ActivateEntity(iUI);
// beam start
int iBeamStart = CreateEntityByName("prop_dynamic_override");
Format(sBuffer, sizeof(sBuffer), "vort_beam_start_%d", g_iCounter);
DispatchKeyValue(iBeamStart, "targetname", sBuffer);
DispatchKeyValue(iBeamStart, "model", "models/props/cs_italy/bananna.mdl");
DispatchKeyValue(iBeamStart, "disableshadows", "1");
DispatchKeyValue(iBeamStart, "disablereceiveshadows", "1");
DispatchKeyValue(iBeamStart, "DisableBoneFollowers", "1");
DispatchKeyValue(iBeamStart, "rendermode", "10");
fOriginTemp[0] = fOrigin[0] + 29.0;
fOriginTemp[1] = fOrigin[1] - 0.0;
fOriginTemp[2] = fOrigin[2] - 8.0;
DispatchKeyValueVector(iBeamStart, "origin", fOriginTemp);
DispatchSpawn(iBeamStart);
ActivateEntity(iBeamStart);
// beam end
int iBeamEnd = CreateEntityByName("prop_dynamic_override");
Format(sBuffer, sizeof(sBuffer), "vort_beam_end_%d", g_iCounter);
DispatchKeyValue(iBeamEnd, "targetname", sBuffer);
DispatchKeyValue(iBeamEnd, "model", "models/props/cs_italy/bananna.mdl");
DispatchKeyValue(iBeamEnd, "disableshadows", "1");
DispatchKeyValue(iBeamEnd, "disablereceiveshadows", "1");
DispatchKeyValue(iBeamEnd, "DisableBoneFollowers", "1");
DispatchKeyValue(iBeamEnd, "rendermode", "10");
fOriginTemp[0] = fOrigin[0] + 1743.0;
fOriginTemp[1] = fOrigin[1] - 0.0;
fOriginTemp[2] = fOrigin[2] - 8.0;
DispatchKeyValueVector(iBeamEnd, "origin", fOriginTemp);
DispatchSpawn(iBeamEnd);
ActivateEntity(iBeamEnd);
// Beam
int iBeam = CreateEntityByName("env_beam");
Format(sBuffer, sizeof(sBuffer), "vort_beam_%d", g_iCounter);
DispatchKeyValue(iBeam, "targetname", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_beam_start_%d", g_iCounter);
DispatchKeyValue(iBeam, "LightningStart", sBuffer);
Format(sBuffer, sizeof(sBuffer), "vort_beam_end_%d", g_iCounter);
DispatchKeyValue(iBeam, "LightningEnd", sBuffer);
DispatchKeyValue(iBeam, "BoltWidth", "3");
DispatchKeyValue(iBeam, "NoiseAmplitude", "1");
DispatchKeyValue(iBeam, "decalname", "Bigshot");
DispatchKeyValue(iBeam, "framerate", "0");
DispatchKeyValue(iBeam, "framestart", "0");
DispatchKeyValue(iBeam, "life", "1");
DispatchKeyValue(iBeam, "spawnflags", "48");
DispatchKeyValue(iBeam, "TouchType", "1");
DispatchKeyValue(iBeam, "rendercolor", "0 200 0");
DispatchKeyValue(iBeam, "texture", "sprites/laserbeam.spr");
DispatchSpawn(iBeam);
SetVariantString("!activator");
AcceptEntityInput(iModel, "SetParent", iKnife);
SetVariantString("!activator");
AcceptEntityInput(iTrigger, "SetParent", iKnife);
SetVariantString("!activator");
AcceptEntityInput(iBeamStart, "SetParent", iKnife);
SetVariantString("!activator");
AcceptEntityInput(iBeamEnd, "SetParent", iKnife);
SetVariantString("!activator");
AcceptEntityInput(iRelay, "SetParent", iKnife);
SetVariantString("!activator");
AcceptEntityInput(iPush, "SetParent", iKnife);
SetVariantString("!activator");
AcceptEntityInput(iTrigger, "Enable");
g_iCounter ++;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void VortigauntPickup(const char[] output, int caller, int activator, float delay)
{
PrintToChatAll("** Vortigaunt has been picked up **");
PrintToChat(activator, "Right Click to Pull Humans in front of you.");
}