ItemSpawn: Added Jumper
This commit is contained in:
parent
44699bcc7a
commit
64a8e01aad
ItemSpawn/scripting
@ -11,6 +11,7 @@ int g_iCounter = 0;
|
||||
|
||||
#include "items\balrog.inc"
|
||||
#include "items\doghuman.inc"
|
||||
#include "items\jumper.inc"
|
||||
#include "items\tnt.inc"
|
||||
#include "items\vortigaunt.inc"
|
||||
#include "items\whiteknight.inc"
|
||||
@ -37,6 +38,7 @@ public void OnPluginStart()
|
||||
RegAdminCmd("sm_tnt", Command_TNT, ADMFLAG_KICK);
|
||||
RegAdminCmd("sm_balrog", Command_Balrog, ADMFLAG_KICK);
|
||||
RegAdminCmd("sm_humandog", Command_HumanDog, ADMFLAG_KICK);
|
||||
RegAdminCmd("sm_jumper", Command_Jumper, ADMFLAG_KICK);
|
||||
RegAdminCmd("sm_vortigaunt", Command_Vortigaunt, ADMFLAG_KICK);
|
||||
RegAdminCmd("sm_whiteknight", Command_WhiteKnight, ADMFLAG_KICK);
|
||||
|
||||
|
@ -358,7 +358,7 @@ public void BalrogPickup(const char[] output, int caller, int activator, float d
|
||||
{
|
||||
ServerCommand("say ** %N has picked up Balrog **", activator);
|
||||
|
||||
PrintToChat(activator, " RIGHT CLICK = MOTIVATE ZOMBIES and LEFT CLICK = ATTACK.");
|
||||
PrintToChat(activator, "RIGHT CLICK = MOTIVATE ZOMBIES and LEFT CLICK = ATTACK.");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
155
ItemSpawn/scripting/items/jumper.inc
Normal file
155
ItemSpawn/scripting/items/jumper.inc
Normal file
@ -0,0 +1,155 @@
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action Command_Jumper(int client, int argc)
|
||||
{
|
||||
float fOrigin[3];
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
GetClientEyePosition(client, fOrigin);
|
||||
SpawnJumper(fOrigin);
|
||||
LogAction(client, -1, "\"%L\" spawned Jumper 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_IsClientZombie(iTargets[i])))
|
||||
{
|
||||
GetClientEyePosition(iTargets[i], fOrigin);
|
||||
SpawnJumper(fOrigin);
|
||||
LogAction(client, -1, "\"%L\" gave Jumper to \"%L\".", client, iTargets[i]);
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void SpawnJumper(float fOrigin[3])
|
||||
{
|
||||
float fOriginTemp[3];
|
||||
|
||||
// weapon_knife.
|
||||
int iKnife = CreateEntityAtOrigin("weapon_knife", fOrigin);
|
||||
DispatchKeyFormat(iKnife, "targetname", "item_jumper_knife_%d", g_iCounter);
|
||||
DispatchKeyFormat(iKnife, "hammerid", "11051995%d", g_iCounter);
|
||||
DispatchKeyFormat(iKnife, "spawnflags", "1");
|
||||
DispatchKeyFormat(iKnife, "angles", "0 0 0");
|
||||
DispatchKeyFormat(iKnife, "OnPlayerPickup", "item_jumper_controls_%d,Activate,,0,1", g_iCounter);
|
||||
|
||||
SpawnAndActivate(iKnife);
|
||||
|
||||
HookSingleEntityOutput(iKnife, "OnPlayerPickup", JumperPickup, true);
|
||||
|
||||
// light origin.
|
||||
fOriginTemp[0] = fOrigin[0] + 0.0;
|
||||
fOriginTemp[1] = fOrigin[1] + 0.0;
|
||||
fOriginTemp[2] = fOrigin[2] + 6.0;
|
||||
|
||||
// light.
|
||||
int iLight = CreateEntityAtOrigin("light_dynamic", fOriginTemp);
|
||||
DispatchKeyFormat(iLight, "targetname", "item_jumper_light_%d", g_iCounter);
|
||||
DispatchKeyFormat(iLight, "style", "0");
|
||||
DispatchKeyFormat(iLight, "spotlight_radius", "180");
|
||||
DispatchKeyFormat(iLight, "spawnflags", "1");
|
||||
DispatchKeyFormat(iLight, "pitch", "-90");
|
||||
DispatchKeyFormat(iLight, "distance", "130");
|
||||
DispatchKeyFormat(iLight, "brightness", "10");
|
||||
DispatchKeyFormat(iLight, "angles", "0 0 0");
|
||||
DispatchKeyFormat(iLight, "_zero_percent_distance", "50");
|
||||
DispatchKeyFormat(iLight, "_quadratic_attn", "115");
|
||||
DispatchKeyFormat(iLight, "_linear_attn", "70");
|
||||
DispatchKeyFormat(iLight, "_lightHDR", "-1 -1 -1 1");
|
||||
DispatchKeyFormat(iLight, "_light", "255 128 0 1");
|
||||
DispatchKeyFormat(iLight, "_inner_cone", "0");
|
||||
DispatchKeyFormat(iLight, "_fifty_percent_distance", "42");
|
||||
DispatchKeyFormat(iLight, "_constant_attn", "50");
|
||||
DispatchKeyFormat(iLight, "_cone", "0");
|
||||
SpawnAndActivate(iLight);
|
||||
ParentToEntity(iLight, iKnife);
|
||||
|
||||
// trigger_once strip.
|
||||
int iTriggerStrip = CreateEntityAtOrigin("trigger_once", fOrigin);
|
||||
DispatchKeyFormat(iTriggerStrip, "targetname", "item_jumper_strip_%d", g_iCounter);
|
||||
DispatchKeyFormat(iTriggerStrip, "filtername", "item_filter_zombie");
|
||||
DispatchKeyFormat(iTriggerStrip, "spawnflags", "1");
|
||||
DispatchKeyFormat(iTriggerStrip, "startdisabled", "1");
|
||||
DispatchKeyFormat(iTriggerStrip, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1");
|
||||
SpawnAndActivate(iTriggerStrip);
|
||||
ParentToEntity(iTriggerStrip, iKnife);
|
||||
|
||||
// make the trigger work.
|
||||
SetEntityBBox(iTriggerStrip, view_as<float>({-8.0, -8.0, -8.0}), view_as<float>({8.0, 8.0, 8.0}));
|
||||
SetEntityProps(iTriggerStrip);
|
||||
|
||||
// logic_relay jump.
|
||||
int iRelayJump = CreateEntityAtOrigin("logic_relay", fOrigin);
|
||||
DispatchKeyFormat(iRelayJump, "targetname", "item_jumper_relay_%d", g_iCounter);
|
||||
DispatchKeyFormat(iRelayJump, "spawnflags", "0");
|
||||
DispatchKeyFormat(iRelayJump, "OnTrigger", "!self,Disable,,0,-1");
|
||||
DispatchKeyFormat(iRelayJump, "OnTrigger", "!self,Enable,,5,-1");
|
||||
SpawnAndActivate(iRelayJump);
|
||||
ParentToEntity(iRelayJump, iKnife);
|
||||
|
||||
HookSingleEntityOutput(iRelayJump, "OnTrigger", JumperUse, false);
|
||||
|
||||
|
||||
// game_ui.
|
||||
int iControls = CreateEntityAtOrigin("game_ui", fOrigin);
|
||||
DispatchKeyFormat(iControls, "targetname", "item_jumper_controls_%d", g_iCounter);
|
||||
DispatchKeyFormat(iControls, "spawnflags", "0");
|
||||
DispatchKeyFormat(iControls, "fieldofview", "-1.0");
|
||||
DispatchKeyFormat(iControls, "PressedAttack2", "item_jumper_relay_%d,Trigger,,0,-1", g_iCounter);
|
||||
SpawnAndActivate(iControls);
|
||||
ParentToEntity(iControls, iKnife);
|
||||
|
||||
AcceptEntityInput(iTriggerStrip, "Enable");
|
||||
g_iCounter++;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void JumperPickup(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
ServerCommand("say ** %N has picked up Jumper **", activator);
|
||||
|
||||
PrintToChat(activator, "RIGHT CLICK = Jump Boost");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void JumperUse(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fPushVector[3];
|
||||
fPushVector[0] = 0.0;
|
||||
fPushVector[1] = 0.0;
|
||||
fPushVector[2] = 600.0;
|
||||
|
||||
float fCurrentVector[3];
|
||||
GetEntPropVector(activator, Prop_Data, "m_vecVelocity", fCurrentVector);
|
||||
|
||||
fPushVector[0] += fCurrentVector[0];
|
||||
fPushVector[1] += fCurrentVector[1];
|
||||
fPushVector[2] += fCurrentVector[2];
|
||||
|
||||
TeleportEntity(activator, NULL_VECTOR, NULL_VECTOR, fPushVector);
|
||||
}
|
Loading…
Reference in New Issue
Block a user