298 lines
12 KiB
PHP
298 lines
12 KiB
PHP
|
//----------------------------------------------------------------------------------------------------
|
||
|
// Purpose:
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
public Action Command_HumanDog(int client, int argc)
|
||
|
{
|
||
|
float fOrigin[3];
|
||
|
|
||
|
if (argc < 1)
|
||
|
{
|
||
|
GetClientEyePosition(client, fOrigin);
|
||
|
SpawnHumanDog(fOrigin);
|
||
|
LogAction(client, -1, "\"%L\" spawned Human Dog at <%f><%f><%f>.", client, fOrigin[0], fOrigin[1], fOrigin[2]);
|
||
|
return Plugin_Handled;
|
||
|
}
|
||
|
|
||
|
char sArgs[64];
|
||
|
char sTargetName[MAX_TARGET_LENGTH];
|
||
|
int iTargets[MAXPLAYERS];
|
||
|
int iTargetCount;
|
||
|
bool bIsML;
|
||
|
|
||
|
GetCmdArg(1, sArgs, sizeof(sArgs));
|
||
|
|
||
|
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
|
||
|
{
|
||
|
ReplyToTargetError(client, iTargetCount);
|
||
|
return Plugin_Handled;
|
||
|
}
|
||
|
|
||
|
for (int i = 0; i < iTargetCount; i++)
|
||
|
{
|
||
|
if(IsClientInGame(iTargets[i]) && IsPlayerAlive(iTargets[i]) && (ZR_IsClientHuman(iTargets[i])))
|
||
|
{
|
||
|
GetClientEyePosition(iTargets[i], fOrigin);
|
||
|
SpawnHumanDog(fOrigin);
|
||
|
LogAction(client, -1, "\"%L\" gave Human Dog to \"%L\".", client, iTargets[i]);
|
||
|
}
|
||
|
}
|
||
|
return Plugin_Handled;
|
||
|
}
|
||
|
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
// Purpose:
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
public void SpawnHumanDog(float fOrigin[3])
|
||
|
{
|
||
|
char sBuffer[256];
|
||
|
float fOriginTemp[3];
|
||
|
|
||
|
// Knife
|
||
|
int iKnife = CreateEntityByName("weapon_knife");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_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), "human_dog_ui_%d,Activate,,0,-1", g_iCounter);
|
||
|
DispatchKeyValue(iKnife, "OnPlayerPickup", sBuffer);
|
||
|
DispatchSpawn(iKnife);
|
||
|
ActivateEntity(iKnife);
|
||
|
HookSingleEntityOutput(iKnife, "OnPlayerPickup", HumanDogPickup, true);
|
||
|
|
||
|
// Model
|
||
|
int iModel = CreateEntityByName("prop_dynamic");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_model_%d", g_iCounter);
|
||
|
DispatchKeyValue(iModel, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iModel, "model", "models/player/pil/re1/dog/dog_pil.mdl");
|
||
|
DispatchKeyValue(iModel, "DisableBoneFollowers", "1");
|
||
|
DispatchKeyValue(iModel, "angles", "0 0 0");
|
||
|
DispatchKeyValue(iModel, "solid", "0");
|
||
|
DispatchKeyValue(iModel, "skin", "1");
|
||
|
DispatchKeyValue(iModel, "DefaultAnim", "Run_lower");
|
||
|
fOriginTemp[0] = fOrigin[0] + 10.4;
|
||
|
fOriginTemp[1] = fOrigin[1] - 2.0;
|
||
|
fOriginTemp[2] = fOrigin[2] - 40.32;
|
||
|
DispatchKeyValueVector(iModel, "origin", fOriginTemp);
|
||
|
DispatchSpawn(iModel);
|
||
|
ActivateEntity(iModel);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iModel, "SetParent", iKnife);
|
||
|
|
||
|
// pickup trigger_once
|
||
|
int iTrigger = CreateEntityByName("trigger_once");
|
||
|
Format(sBuffer, sizeof(sBuffer), "tnt_trigger_%d", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iTrigger, "spawnflags", "1");
|
||
|
DispatchKeyValue(iTrigger, "startdisabled", "1");
|
||
|
DispatchKeyValue(iTrigger, "filtername", "item_spawn_human_filter");
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1");
|
||
|
DispatchKeyValueVector(iTrigger, "origin", fOrigin);
|
||
|
DispatchSpawn(iTrigger);
|
||
|
ActivateEntity(iTrigger);
|
||
|
SetEntityModel(iTrigger, "models/vortigaunt_slave.mdl");
|
||
|
float fMinbounds[3] = {-1.0, -1.0, -10.0};
|
||
|
float fMaxbounds[3] = {1.0, 1.0, 10.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);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iTrigger, "SetParent", iKnife);
|
||
|
|
||
|
// Relay Trigger
|
||
|
int iRelayTrigger = CreateEntityByName("logic_relay");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger_%d", g_iCounter);
|
||
|
DispatchKeyValue(iRelayTrigger, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iRelayTrigger, "spawnflags", "0");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger2_%d,Trigger,,0,4", g_iCounter);
|
||
|
DispatchKeyValue(iRelayTrigger, "OnTrigger", sBuffer);
|
||
|
DispatchSpawn(iRelayTrigger);
|
||
|
ActivateEntity(iRelayTrigger);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iRelayTrigger, "SetParent", iKnife);
|
||
|
|
||
|
// Relay Trigger2
|
||
|
int iRelayTrigger2 = CreateEntityByName("logic_relay");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger2_%d", g_iCounter);
|
||
|
DispatchKeyValue(iRelayTrigger2, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iRelayTrigger2, "spawnflags", "0");
|
||
|
DispatchSpawn(iRelayTrigger2);
|
||
|
ActivateEntity(iRelayTrigger2);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iRelayTrigger2, "SetParent", iKnife);
|
||
|
HookSingleEntityOutput(iRelayTrigger2, "OnTrigger", HumanDogUse, false);
|
||
|
|
||
|
// Game UI
|
||
|
int iUI = CreateEntityByName("game_ui");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_ui_%d", g_iCounter);
|
||
|
DispatchKeyValue(iUI, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iUI, "spawnflags", "0");
|
||
|
DispatchKeyValue(iUI, "FieldOfView", "-1.0");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_relay_trigger_%d,Trigger,,0,-1", g_iCounter);
|
||
|
DispatchKeyValue(iUI, "PressedAttack2", sBuffer);
|
||
|
DispatchSpawn(iUI);
|
||
|
ActivateEntity(iUI);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iUI, "SetParent", iKnife);
|
||
|
|
||
|
// enable pickup trigger
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iTrigger, "Enable");
|
||
|
|
||
|
g_iCounter ++;
|
||
|
}
|
||
|
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
// Purpose:
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
public void HumanDogPickup(const char[] output, int caller, int activator, float delay)
|
||
|
{
|
||
|
char sBuffer[128];
|
||
|
Format(sBuffer, sizeof(sBuffer), "say ** %N has picked up Human Dog **", activator);
|
||
|
SetVariantString(sBuffer);
|
||
|
AcceptEntityInput(g_iConsole, "Command");
|
||
|
PrintToChat(activator, "RIGHT CLICK with your KNIFE to leave a present for the Zombies (max 4)");
|
||
|
CreateTimer(2.0, EquipWeapons, GetClientUserId(activator), TIMER_FLAG_NO_MAPCHANGE);
|
||
|
}
|
||
|
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
// Purpose:
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
public void HumanDogUse(const char[] output, int caller, int activator, float delay)
|
||
|
{
|
||
|
char sBuffer[256];
|
||
|
float fOrigin[3];
|
||
|
float fAngles[3];
|
||
|
GetClientEyeAngles(activator, fAngles);
|
||
|
GetClientEyePosition(activator, fOrigin);
|
||
|
fAngles[0] = 0.0;
|
||
|
fAngles[2] = 0.0;
|
||
|
fOrigin[0] = fOrigin[0] + Cosine(DegToRad(fAngles[1])) * -50.0;
|
||
|
fOrigin[1] = fOrigin[1] + Sine(DegToRad(fAngles[1])) * -50.0;
|
||
|
fOrigin[2] = fOrigin[2] - 62.00;
|
||
|
|
||
|
// Prop
|
||
|
int iProp = CreateEntityByName("prop_dynamic");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_%d", g_iCounter);
|
||
|
DispatchKeyValue(iProp, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iProp, "model", "models/poo/curlygpoo.mdl");
|
||
|
DispatchKeyValue(iProp, "spawnflags", "0");
|
||
|
DispatchKeyValue(iProp, "PerformanceMode", "0");
|
||
|
DispatchKeyValue(iProp, "solid", "0");
|
||
|
DispatchKeyValueVector(iProp, "origin", fOrigin);
|
||
|
DispatchSpawn(iProp);
|
||
|
ActivateEntity(iProp);
|
||
|
|
||
|
// trigger
|
||
|
int iTrigger = CreateEntityByName("trigger_once");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_trigger_%d", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iTrigger, "spawnflags", "1");
|
||
|
DispatchKeyValue(iTrigger, "startdisabled", "0");
|
||
|
DispatchKeyValue(iTrigger, "filtername", "item_spawn_zombie_filter");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_%d,Kill,,1,1", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_hurt_%d,Enable,,0,1", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_hurt_%d,Disable,,0.25,1", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_particles_%d,Start,,0,-1", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_particles_%d,Kill,,1,-1", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_sound_%d,PlaySound,,0,-1", g_iCounter);
|
||
|
DispatchKeyValue(iTrigger, "OnStartTouch", sBuffer);
|
||
|
DispatchKeyValueVector(iTrigger, "origin", fOrigin);
|
||
|
DispatchSpawn(iTrigger);
|
||
|
ActivateEntity(iTrigger);
|
||
|
SetEntityModel(iTrigger, "models/vortigaunt_slave.mdl");
|
||
|
float fMinbounds[3] = {-12.0, -12.0, -7.5};
|
||
|
float fMaxbounds[3] = {12.0, 12.0, 7.5};
|
||
|
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);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iTrigger, "SetParent", iProp);
|
||
|
|
||
|
// poo hurt
|
||
|
int iHurt = CreateEntityByName("trigger_hurt");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_poo_hurt_%d", g_iCounter);
|
||
|
DispatchKeyValue(iHurt, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iHurt, "spawnflags", "1");
|
||
|
DispatchKeyValue(iHurt, "startdisabled", "1");
|
||
|
DispatchKeyValue(iHurt, "filtername", "item_spawn_zombie_filter");
|
||
|
DispatchKeyValue(iHurt, "damagetype", "0");
|
||
|
DispatchKeyValue(iHurt, "damagemodel", "0");
|
||
|
DispatchKeyValue(iHurt, "damagecap", "20");
|
||
|
DispatchKeyValue(iHurt, "damage", "8000");
|
||
|
DispatchKeyValueVector(iHurt, "origin", fOrigin);
|
||
|
DispatchSpawn(iHurt);
|
||
|
ActivateEntity(iHurt);
|
||
|
SetEntityModel(iHurt, "models/vortigaunt_slave.mdl");
|
||
|
float fMinbounds2[3] = {-96.0, -112.0, -142.0};
|
||
|
float fMaxbounds2[3] = {96.0, 112.0, 142.0};
|
||
|
SetEntPropVector(iHurt, Prop_Send, "m_vecMins", fMinbounds2);
|
||
|
SetEntPropVector(iHurt, Prop_Send, "m_vecMaxs", fMaxbounds2);
|
||
|
SetEntProp(iHurt, Prop_Send, "m_nSolidType", 3);
|
||
|
int enteffects2 = GetEntProp(iHurt, Prop_Send, "m_fEffects");
|
||
|
enteffects2 |= 32;
|
||
|
SetEntProp(iHurt, Prop_Send, "m_fEffects", enteffects2);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iHurt, "SetParent", iProp);
|
||
|
|
||
|
// Particles
|
||
|
int iParticles = CreateEntityByName("info_particle_system");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_particles_%d", g_iCounter);
|
||
|
DispatchKeyValue(iParticles, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iParticles, "effect_name", "fire_small_01");
|
||
|
DispatchKeyValue(iParticles, "start_active", "0");
|
||
|
DispatchKeyValueVector(iParticles, "origin", fOrigin);
|
||
|
DispatchSpawn(iParticles);
|
||
|
ActivateEntity(iParticles);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iParticles, "SetParent", iProp);
|
||
|
|
||
|
// Sound
|
||
|
int iSound = CreateEntityByName("ambient_generic");
|
||
|
Format(sBuffer, sizeof(sBuffer), "human_dog_sound_%d", g_iCounter);
|
||
|
DispatchKeyValue(iSound, "targetname", sBuffer);
|
||
|
DispatchKeyValue(iSound, "spawnflags", "49");
|
||
|
DispatchKeyValue(iSound, "radius", "1250");
|
||
|
DispatchKeyValue(iSound, "message", "ambient/explosions/explode_9.wav");
|
||
|
DispatchKeyValue(iSound, "volume", "10");
|
||
|
DispatchKeyValue(iSound, "health", "10");
|
||
|
DispatchKeyValue(iSound, "pitch", "100");
|
||
|
DispatchKeyValue(iSound, "pitchstart", "100");
|
||
|
DispatchKeyValueVector(iSound, "origin", fOrigin);
|
||
|
DispatchSpawn(iSound);
|
||
|
ActivateEntity(iSound);
|
||
|
SetVariantString("!activator");
|
||
|
AcceptEntityInput(iSound, "SetParent", iProp);
|
||
|
|
||
|
g_iCounter ++;
|
||
|
}
|
||
|
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
// Purpose:
|
||
|
//----------------------------------------------------------------------------------------------------
|
||
|
public Action EquipWeapons(Handle timer, any userid)
|
||
|
{
|
||
|
int client = GetClientOfUserId(userid);
|
||
|
|
||
|
if (client != 0)
|
||
|
{
|
||
|
GivePlayerItem(client, "weapon_p90");
|
||
|
GivePlayerItem(client, "weapon_elite");
|
||
|
GivePlayerItem(client, "item_kevlar");
|
||
|
GivePlayerItem(client, "weapon_hegrenade");
|
||
|
}
|
||
|
}
|