ItemSpawn: Added unifininished Earth Staff

This commit is contained in:
neon 2018-08-17 20:29:56 +02:00
parent 0b0a0a278a
commit 292b47a4a7
21 changed files with 321 additions and 8 deletions

View File

@ -0,0 +1,6 @@
"VertexLitGeneric"
{
"$basetexture" "models/Staff/staffofmagnus"
"$nofog" 1
"$model" "1"
}

View File

@ -0,0 +1,6 @@
"vertexlitgeneric"
{
"$basetexture" "de_dust/rockwall01"
"$surfaceprop" "concrete"
"%keywords" "cstrike"
}

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.

Binary file not shown.

View File

@ -0,0 +1,24 @@
"Games"
{
"cstrike"
{
"Offsets"
{
"GetSlot"
{
"windows" "320"
"linux" "321"
}
"BumpWeapon"
{
"windows" "397"
"linux" "398"
}
"OnPickedUp"
{
"windows" "300"
"linux" "301"
}
}
}
}

View File

@ -3,14 +3,19 @@
#include <sourcemod>
#include <sdktools>
#include <zombiereloaded>
#include <cstrike>
#pragma semicolon 1
int g_iConsole;
int g_iCounter = 0;
Handle g_hGetSlot;
Handle g_hBumpWeapon;
Handle g_hOnPickedUp;
#include "items\balrog.inc"
#include "items\doghuman.inc"
#include "items\earth.inc"
#include "items\jumper.inc"
#include "items\tnt.inc"
#include "items\vortigaunt.inc"
@ -34,15 +39,91 @@ public Plugin myinfo =
public void OnPluginStart()
{
HookEvent("round_start", OnRoundStart, EventHookMode_Post);
RegAdminCmd("sm_tnt", Command_TNT, ADMFLAG_KICK);
RegAdminCmd("sm_balrog", Command_Balrog, ADMFLAG_KICK);
RegAdminCmd("sm_humandog", Command_HumanDog, ADMFLAG_KICK);
RegAdminCmd("sm_earth", Command_Earth, ADMFLAG_KICK);
RegAdminCmd("sm_jumper", Command_Jumper, ADMFLAG_KICK);
RegAdminCmd("sm_tnt", Command_TNT, ADMFLAG_KICK);
RegAdminCmd("sm_vortigaunt", Command_Vortigaunt, ADMFLAG_KICK);
RegAdminCmd("sm_whiteknight", Command_WhiteKnight, ADMFLAG_KICK);
LoadTranslations("common.phrases");
Handle hGameConf = LoadGameConfigFile("plugin.entWatch");
if(hGameConf == INVALID_HANDLE)
{
SetFailState("Couldn't load plugin.ItemSpawn game config!");
return;
}
if(GameConfGetOffset(hGameConf, "GetSlot") == -1)
{
CloseHandle(hGameConf);
SetFailState("Couldn't get GetSlot offset from game config!");
return;
}
if(GameConfGetOffset(hGameConf, "BumpWeapon") == -1)
{
CloseHandle(hGameConf);
SetFailState("Couldn't get BumpWeapon offset from game config!");
return;
}
if(GameConfGetOffset(hGameConf, "OnPickedUp") == -1)
{
CloseHandle(hGameConf);
SetFailState("Couldn't get OnPickedUp offset from game config!");
return;
}
// 320 CBaseCombatWeapon::GetSlot(void)const
StartPrepSDKCall(SDKCall_Entity);
if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "GetSlot"))
{
CloseHandle(hGameConf);
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"GetSlot\" failed!");
return;
}
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
g_hGetSlot = EndPrepSDKCall();
// 397 CCSPlayer::BumpWeapon(CBaseCombatWeapon *)
StartPrepSDKCall(SDKCall_Player);
if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "BumpWeapon"))
{
CloseHandle(hGameConf);
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"BumpWeapon\" failed!");
return;
}
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
g_hBumpWeapon = EndPrepSDKCall();
// 300 CBaseCombatWeapon::OnPickedUp(CBaseCombatCharacter *)
StartPrepSDKCall(SDKCall_Entity);
if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "OnPickedUp"))
{
CloseHandle(hGameConf);
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"OnPickedUp\" failed!");
return;
}
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
g_hOnPickedUp = EndPrepSDKCall();
if(g_hGetSlot == INVALID_HANDLE)
{
SetFailState("Couldn't prepare GetSlot SDKCall!");
return;
}
if(g_hGetSlot == INVALID_HANDLE)
{
SetFailState("Couldn't prepare BumpWeapon SDKCall!");
return;
}
if(g_hOnPickedUp == INVALID_HANDLE)
{
SetFailState("Couldn't prepare OnPickedUp SDKCall!");
return;
}
}
//----------------------------------------------------------------------------------------------------
@ -91,8 +172,29 @@ public void OnMapStart()
AddFileToDownloadsTable("models/poo/curlygpoo.sw.vtx");
AddFileToDownloadsTable("models/poo/curlygpoo.vvd");
AddFileToDownloadsTable("materials/models/poo/curlypoo.vmt");
AddFileToDownloadsTable("materials/models/poo/curlypoo.vtf");
AddFileToDownloadsTable("materials/models/poo/curlypoo.vtf");
// Earth Staff
PrecacheModel("models/staff/staff.mdl");
AddFileToDownloadsTable("models/staff/staff.dx80.vtx");
AddFileToDownloadsTable("models/staff/staff.dx90.vtx");
AddFileToDownloadsTable("models/staff/staff.mdl");
AddFileToDownloadsTable("models/staff/staff.phy");
AddFileToDownloadsTable("models/staff/staff.sw.vtx");
AddFileToDownloadsTable("models/staff/staff.vvd");
AddFileToDownloadsTable("materials/models/Staff/staffofmagnus.vmt");
AddFileToDownloadsTable("materials/models/Staff/staffofmagnus.vtf");
// Earth Prop
PrecacheModel("models/ffxii/earthmodel1.mdl");
AddFileToDownloadsTable("models/ffxii/earthmodel1.dx80.vtx");
AddFileToDownloadsTable("models/ffxii/earthmodel1.dx90.vtx");
AddFileToDownloadsTable("models/ffxii/earthmodel1.mdl");
AddFileToDownloadsTable("models/ffxii/earthmodel1.phy");
AddFileToDownloadsTable("models/ffxii/earthmodel1.sw.vtx");
AddFileToDownloadsTable("models/ffxii/earthmodel1.vvd");
AddFileToDownloadsTable("materials/models/ffxii/earthmodel1/rockwall01.vmt");
// TNT
PrecacheModel("models/props/furnitures/humans/barrel01b.mdl");
AddFileToDownloadsTable("models/props/furnitures/humans/barrel01b.dx80.vtx");

View File

@ -0,0 +1,175 @@
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Command_Earth(int client, int argc)
{
float fOrigin[3];
if (argc < 1)
{
GetClientEyePosition(client, fOrigin);
SpawnEarthStaff(fOrigin);
LogAction(client, -1, "\"%L\" spawned Earth-Staff 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);
SpawnEarthStaff(fOrigin, iTargets[i]);
LogAction(client, -1, "\"%L\" gave Earth-Staff to \"%L\".", client, iTargets[i]);
}
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
void SpawnEarthStaff(float fOrigin[3], int client = -1)
{
float fOriginTemp[3];
// weapon_knife.
int iPistol = CreateEntityAtOrigin("weapon_elite", fOrigin);
DispatchKeyFormat(iPistol, "targetname", "item_earth_staff_pistol_%d", g_iCounter);
DispatchKeyFormat(iPistol, "hammerid", "11051995%d", g_iCounter);
DispatchKeyFormat(iPistol, "spawnflags", "1");
DispatchKeyFormat(iPistol, "angles", "0 0 0");
DispatchKeyFormat(iPistol, "ammo", "999");
DispatchKeyFormat(iPistol, "OnPlayerPickup", "item_earth_staff_controls_%d,Activate,,0,1", g_iCounter);
SpawnAndActivate(iPistol);
HookSingleEntityOutput(iPistol, "OnPlayerPickup", EarthStaffPickup, false);
// model origin.
fOriginTemp[0] = fOrigin[0] + 24.0;
fOriginTemp[1] = fOrigin[1] - 16.0;
fOriginTemp[2] = fOrigin[2] - 32.0;
// prop_dynamic model.
int iModel = CreateEntityAtOrigin("prop_dynamic", fOriginTemp);
DispatchKeyFormat(iModel, "targetname", "item_earth_staff_model_%d", g_iCounter);
DispatchKeyFormat(iModel, "model", "models/staff/staff.mdl");
DispatchKeyFormat(iModel, "disablebonefollowers", "1");
DispatchKeyFormat(iModel, "defaultanim", "idle");
DispatchKeyFormat(iModel, "angles", "0 270 0");
DispatchKeyFormat(iModel, "solid", "0");
SpawnAndActivate(iModel);
ParentToEntity(iModel, iPistol);
// ambient_generic earth.
int iSoundEarth = CreateEntityAtOrigin("ambient_generic", fOrigin);
DispatchKeyFormat(iSoundEarth, "targetname", "item_earth_staff_sound_%d", g_iCounter);
DispatchKeyFormat(iSoundEarth, "spawnflags", "48");
DispatchKeyFormat(iSoundEarth, "radius", "1250");
DispatchKeyFormat(iSoundEarth, "sourceentityname", "item_earth_staff_model_%d", g_iCounter);
DispatchKeyFormat(iSoundEarth, "message", "physics/concrete/boulder_impact_hard1.wav");
DispatchKeyFormat(iSoundEarth, "volume", "10");
DispatchKeyFormat(iSoundEarth, "health", "10");
DispatchKeyFormat(iSoundEarth, "pitch", "100");
DispatchKeyFormat(iSoundEarth, "pitchstart", "100");
SpawnAndActivate(iSoundEarth);
ParentToEntity(iSoundEarth, iPistol);
// logic_relay earth.
int iRelayEarth = CreateEntityAtOrigin("logic_relay", fOrigin);
DispatchKeyFormat(iRelayEarth, "targetname", "item_earth_staff_relay_%d", g_iCounter);
DispatchKeyFormat(iRelayEarth, "spawnflags", "0");
DispatchKeyFormat(iRelayEarth, "OnTrigger", "!self,Disable,,0,-1");
DispatchKeyFormat(iRelayEarth, "OnTrigger", "!self,Enable,,5,-1");
DispatchKeyFormat(iRelayEarth, "OnTrigger", "item_earth_staff_sound_%d,PlaySound,,0.75,-1", g_iCounter);
DispatchKeyFormat(iRelayEarth, "OnTrigger", "item_earth_staff_model_%d,SetAnimation,Earth,0,-1", g_iCounter);
SpawnAndActivate(iRelayEarth);
ParentToEntity(iRelayEarth, iPistol);
HookSingleEntityOutput(iRelayEarth, "OnTrigger", EarthStaffUse, false);
// game_ui.
int iControls = CreateEntityAtOrigin("game_ui", fOrigin);
DispatchKeyFormat(iControls, "targetname", "item_earth_staff_controls_%d", g_iCounter);
DispatchKeyFormat(iControls, "spawnflags", "0");
DispatchKeyFormat(iControls, "fieldofview", "-1.0");
DispatchKeyFormat(iControls, "PressedAttack2", "item_earth_staff_relay_%d,Trigger,,0,-1", g_iCounter);
SpawnAndActivate(iControls);
ParentToEntity(iControls, iPistol);
g_iCounter++;
if (client > 0)
{
int iWeaponSlot = SDKCall(g_hGetSlot, iPistol);
int WeaponInSlot = GetPlayerWeaponSlot(client, iWeaponSlot);
if(WeaponInSlot != -1)
CS_DropWeapon(client, WeaponInSlot, false);
if(SDKCall(g_hBumpWeapon, client, iPistol))
SDKCall(g_hOnPickedUp, iPistol, client);
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void EarthStaffPickup(const char[] output, int caller, int activator, float delay)
{
ServerCommand("say ** %N has picked up the Earth-Staff **", activator);
PrintToChat(activator, "Right Click with Knife = Use.");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void EarthStaffUse(const char[] output, int caller, int activator, float delay)
{
CreateTimer(0.75, SpawnEarth, GetClientUserId(activator), TIMER_FLAG_NO_MAPCHANGE);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action SpawnEarth(Handle timer, any userid)
{
int activator = GetClientOfUserId(userid);
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])) * 334.0;
fOrigin[1] = fOrigin[1] + Sine(DegToRad(fAngles[1])) * 334.0;
fOrigin[2] = fOrigin[2] - 23.00;
// prop_dynamic model.
int iModel = CreateEntityAtOrigin("prop_dynamic", fOrigin);
DispatchKeyFormat(iModel, "targetname", "item_earth_prop_%d", g_iCounter);
DispatchKeyFormat(iModel, "model", "models/ffxii/earthmodel1.mdl");
DispatchKeyFormat(iModel, "spawnflags", "0");
DispatchKeyFormat(iModel, "PerformanceMode", "0");
DispatchKeyFormat(iModel, "solid", "6");
DispatchKeyFormat(iModel, "OnUser1", "!self,Break,,6,-1");
DispatchKeyFormat(iModel, "OnUser1", "!self,Kill,,6,-1");
SpawnAndActivate(iModel);
AcceptEntityInput(iModel, "FireUser1");
g_iCounter ++;
}

View File

@ -143,7 +143,7 @@ public void JumperUse(const char[] output, int caller, int activator, float dela
float fPushVector[3];
fPushVector[0] = 0.0;
fPushVector[1] = 0.0;
fPushVector[2] = 600.0;
fPushVector[2] = 500.0;
float fCurrentVector[3];
GetEntPropVector(activator, Prop_Data, "m_vecVelocity", fCurrentVector);

View File

@ -288,7 +288,7 @@ public void TNTPickup(const char[] output, int caller, int activator, float dela
char sBuffer[128];
Format(sBuffer, sizeof(sBuffer), "say ** %N has picked up TNT **", activator);
SetVariantString(sBuffer);
AcceptEntityInput(g_iConsole, "Command");
//AcceptEntityInput(g_iConsole, "Command");
PrintToChat(activator, " RIGHT CLICK = Launch TNT and LEFT CLICK = Switch between 'put down' and 'throw'.");
}

View File

@ -263,7 +263,7 @@ public void VortigauntPickup(const char[] output, int caller, int activator, flo
char sBuffer[128];
Format(sBuffer, sizeof(sBuffer), "say ** %N has picked up Vortigaunt **", activator);
SetVariantString(sBuffer);
AcceptEntityInput(g_iConsole, "Command");
//AcceptEntityInput(g_iConsole, "Command");
PrintToChat(activator, "Right Click to Pull Humans in front of you.");
}