diff --git a/ItemSpawn/content/materials/models/Staff/staffofmagnus.vmt b/ItemSpawn/content/materials/models/Staff/staffofmagnus.vmt new file mode 100644 index 00000000..c8d5a5a7 --- /dev/null +++ b/ItemSpawn/content/materials/models/Staff/staffofmagnus.vmt @@ -0,0 +1,6 @@ +"VertexLitGeneric" +{ + "$basetexture" "models/Staff/staffofmagnus" + "$nofog" 1 + "$model" "1" +} \ No newline at end of file diff --git a/ItemSpawn/content/materials/models/Staff/staffofmagnus.vtf b/ItemSpawn/content/materials/models/Staff/staffofmagnus.vtf new file mode 100644 index 00000000..a1dfc9b0 Binary files /dev/null and b/ItemSpawn/content/materials/models/Staff/staffofmagnus.vtf differ diff --git a/ItemSpawn/content/materials/models/ffxii/earthmodel1/rockwall01.vmt b/ItemSpawn/content/materials/models/ffxii/earthmodel1/rockwall01.vmt new file mode 100644 index 00000000..360845f9 --- /dev/null +++ b/ItemSpawn/content/materials/models/ffxii/earthmodel1/rockwall01.vmt @@ -0,0 +1,6 @@ +"vertexlitgeneric" +{ + "$basetexture" "de_dust/rockwall01" + "$surfaceprop" "concrete" + "%keywords" "cstrike" +} diff --git a/ItemSpawn/content/models/ffxii/earthmodel1.dx80.vtx b/ItemSpawn/content/models/ffxii/earthmodel1.dx80.vtx new file mode 100644 index 00000000..3e1317f4 Binary files /dev/null and b/ItemSpawn/content/models/ffxii/earthmodel1.dx80.vtx differ diff --git a/ItemSpawn/content/models/ffxii/earthmodel1.dx90.vtx b/ItemSpawn/content/models/ffxii/earthmodel1.dx90.vtx new file mode 100644 index 00000000..53ca9465 Binary files /dev/null and b/ItemSpawn/content/models/ffxii/earthmodel1.dx90.vtx differ diff --git a/ItemSpawn/content/models/ffxii/earthmodel1.mdl b/ItemSpawn/content/models/ffxii/earthmodel1.mdl new file mode 100644 index 00000000..d2d05e6d Binary files /dev/null and b/ItemSpawn/content/models/ffxii/earthmodel1.mdl differ diff --git a/ItemSpawn/content/models/ffxii/earthmodel1.phy b/ItemSpawn/content/models/ffxii/earthmodel1.phy new file mode 100644 index 00000000..290689b3 Binary files /dev/null and b/ItemSpawn/content/models/ffxii/earthmodel1.phy differ diff --git a/ItemSpawn/content/models/ffxii/earthmodel1.sw.vtx b/ItemSpawn/content/models/ffxii/earthmodel1.sw.vtx new file mode 100644 index 00000000..948df962 Binary files /dev/null and b/ItemSpawn/content/models/ffxii/earthmodel1.sw.vtx differ diff --git a/ItemSpawn/content/models/ffxii/earthmodel1.vvd b/ItemSpawn/content/models/ffxii/earthmodel1.vvd new file mode 100644 index 00000000..3a631f7c Binary files /dev/null and b/ItemSpawn/content/models/ffxii/earthmodel1.vvd differ diff --git a/ItemSpawn/content/models/staff/staff.dx80.vtx b/ItemSpawn/content/models/staff/staff.dx80.vtx new file mode 100644 index 00000000..4f92013f Binary files /dev/null and b/ItemSpawn/content/models/staff/staff.dx80.vtx differ diff --git a/ItemSpawn/content/models/staff/staff.dx90.vtx b/ItemSpawn/content/models/staff/staff.dx90.vtx new file mode 100644 index 00000000..9752a05b Binary files /dev/null and b/ItemSpawn/content/models/staff/staff.dx90.vtx differ diff --git a/ItemSpawn/content/models/staff/staff.mdl b/ItemSpawn/content/models/staff/staff.mdl new file mode 100644 index 00000000..2ac7674a Binary files /dev/null and b/ItemSpawn/content/models/staff/staff.mdl differ diff --git a/ItemSpawn/content/models/staff/staff.phy b/ItemSpawn/content/models/staff/staff.phy new file mode 100644 index 00000000..0dd6b8df Binary files /dev/null and b/ItemSpawn/content/models/staff/staff.phy differ diff --git a/ItemSpawn/content/models/staff/staff.sw.vtx b/ItemSpawn/content/models/staff/staff.sw.vtx new file mode 100644 index 00000000..cf7a4beb Binary files /dev/null and b/ItemSpawn/content/models/staff/staff.sw.vtx differ diff --git a/ItemSpawn/content/models/staff/staff.vvd b/ItemSpawn/content/models/staff/staff.vvd new file mode 100644 index 00000000..af7a1f9a Binary files /dev/null and b/ItemSpawn/content/models/staff/staff.vvd differ diff --git a/ItemSpawn/gamedata/plugin.ItemSpawn.txt b/ItemSpawn/gamedata/plugin.ItemSpawn.txt new file mode 100644 index 00000000..83cdbfe9 --- /dev/null +++ b/ItemSpawn/gamedata/plugin.ItemSpawn.txt @@ -0,0 +1,24 @@ +"Games" +{ + "cstrike" + { + "Offsets" + { + "GetSlot" + { + "windows" "320" + "linux" "321" + } + "BumpWeapon" + { + "windows" "397" + "linux" "398" + } + "OnPickedUp" + { + "windows" "300" + "linux" "301" + } + } + } +} diff --git a/ItemSpawn/scripting/ItemSpawn.sp b/ItemSpawn/scripting/ItemSpawn.sp index 2d093b56..238ea456 100644 --- a/ItemSpawn/scripting/ItemSpawn.sp +++ b/ItemSpawn/scripting/ItemSpawn.sp @@ -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"); diff --git a/ItemSpawn/scripting/items/earth.inc b/ItemSpawn/scripting/items/earth.inc new file mode 100644 index 00000000..5fba7a19 --- /dev/null +++ b/ItemSpawn/scripting/items/earth.inc @@ -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 ++; +} \ No newline at end of file diff --git a/ItemSpawn/scripting/items/jumper.inc b/ItemSpawn/scripting/items/jumper.inc index a68e51c0..a573a20d 100644 --- a/ItemSpawn/scripting/items/jumper.inc +++ b/ItemSpawn/scripting/items/jumper.inc @@ -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); diff --git a/ItemSpawn/scripting/items/tnt.inc b/ItemSpawn/scripting/items/tnt.inc index a0c338c1..92f15a10 100644 --- a/ItemSpawn/scripting/items/tnt.inc +++ b/ItemSpawn/scripting/items/tnt.inc @@ -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'."); } diff --git a/ItemSpawn/scripting/items/vortigaunt.inc b/ItemSpawn/scripting/items/vortigaunt.inc index 70d5c0f8..8e7cf40d 100644 --- a/ItemSpawn/scripting/items/vortigaunt.inc +++ b/ItemSpawn/scripting/items/vortigaunt.inc @@ -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."); } \ No newline at end of file