33#define DEBUG
44
55#define PLUGIN_AUTHOR " BattlefieldDuck"
6- #define PLUGIN_VERSION " 1.7 "
6+ #define PLUGIN_VERSION " 1.8 "
77
88#include <sourcemod>
99#include <sdkhooks>
@@ -86,6 +86,8 @@ public void OnPluginStart()
8686 RegAdminCmd (" sm_tg" , Command_EquipToolGun , 0 , " Equip a Tool Gun" );
8787 //RegAdminCmd("sm_toolgun", Command_EquipToolGun, 0, "Equip a Tool Gun");
8888
89+ RegAdminCmd (" sm_seq" , Command_SetSequence , 0 , " Usage: !seq <sequence>" );
90+
8991 HookEvent (" player_spawn" , Event_PlayerSpawn );
9092}
9193
@@ -181,6 +183,36 @@ public Action Command_EquipToolGun(int client, int args)
181183 return Plugin_Continue ;
182184}
183185
186+ public Action Command_SetSequence (int client , int args )
187+ {
188+ if (client <= 0 || client > MaxClients || ! IsClientInGame (client ) || ! IsPlayerAlive (client ))
189+ {
190+ return Plugin_Continue ;
191+ }
192+
193+ if (args != 1 )
194+ {
195+ Build_PrintToChat (client , " Usage: !seq <sequence>" );
196+ return Plugin_Continue ;
197+ }
198+
199+ char strSeq [5 ];
200+ GetCmdArg (1 , strSeq , sizeof (strSeq ));
201+
202+ int seq = StringToInt (strSeq );
203+
204+ int entity = GetClientAimEntity (client );
205+ if (! IsValidEntity (entity ))
206+ {
207+ Build_PrintToChat (client , " Please aim on your prop!" );
208+ }
209+
210+ SetEntProp (entity , Prop_Send , " m_nSequence" , seq );
211+ Build_PrintToChat (client , " Set Entity %i to Sequence %i " , entity , seq );
212+
213+ return Plugin_Continue ;
214+ }
215+
184216public void Event_PlayerSpawn (Event event , const char [] name , bool dontBroadcast )
185217{
186218 int client = GetClientOfUserId (event .GetInt (" userid" ));
@@ -220,7 +252,7 @@ public Action WeaponSwitchHookPost(int client, int entity)
220252 return Plugin_Continue ;
221253}
222254
223- #define MAX_TOOLS 10
255+ #define MAX_TOOLS 9
224256public Action OnPlayerRunCmd (int client , int &buttons , int &impulse , float vel [3 ], float angles [3 ], int &weapon , int &subtype , int &cmdnum , int &tickcount , int &seed , int mouse [2 ])
225257{
226258 int iViewModel = GetEntPropEnt (client , Prop_Send , " m_hViewModel" );
@@ -555,6 +587,8 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
555587 }
556588
557589 SetEntProp (entity , Prop_Send , " m_nSequence" , iSequence );
590+ SetEntPropFloat (entity , Prop_Send , " m_flPlaybackRate" , 1.0 );
591+ SetEntPropFloat (entity , Prop_Send , " m_flCycle" , 0.0 );
558592
559593 PrintCenterText (client , " Sequence: %i " , iSequence );
560594 }
@@ -566,21 +600,37 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
566600 if (IsValidEntity (entity ))
567601 {
568602 if (buttons & IN_ATTACK )
603+ {
604+ SetEntPropFloat (entity , Prop_Send , " m_flPlaybackRate" , 1.0 );
605+ }
606+ else if (buttons & IN_ATTACK2 )
569607 {
570- if (SetAnimation (entity ))
571- {
572- PrintCenterText (client , " Set Animation successfully" );
573- }
574- else
575- {
576- PrintCenterText (client , " No Animation found!" );
577- }
608+ SetEntPropFloat (entity , Prop_Send , " m_flPlaybackRate" , 0.0 );
609+ }
610+ }
611+ }
612+ //Set Pose
613+ case (11 ):
614+ {
615+ if (IsValidEntity (entity ))
616+ {
617+ float pose = GetEntPropFloat (entity , Prop_Send , " m_flCycle" );
618+
619+ if (buttons & IN_ATTACK )
620+ {
621+ pose += 10.0 ;
622+
623+ SetEntProp (entity , Prop_Send , " m_bClientSideAnimation" , 1 );
624+ SetEntPropFloat (entity , Prop_Send , " m_flCycle" , pose );
578625 }
579626 else if (buttons & IN_ATTACK2 )
580627 {
581- SetVariantString (" 0.0" );
582- AcceptEntityInput (entity , " SetPlaybackRate" );
628+ pose -= 10.0 ;
629+
630+ SetEntPropFloat (entity , Prop_Send , " m_flCycle" , pose );
583631 }
632+
633+ PrintCenterText (client , " Pose: %.1f " , pose );
584634 }
585635 }
586636 }
@@ -916,7 +966,7 @@ int Duplicator(int iEntity)
916966 return - 1 ;
917967}
918968
919- bool SetAnimation (int entity )
969+ stock bool SetAnimation (int entity )
920970{
921971 char szModel [64 ];
922972 GetEntPropString (entity , Prop_Data , " m_ModelName" , szModel , sizeof (szModel ));
@@ -942,7 +992,8 @@ bool SetAnimation(int entity)
942992 || StrContains (szModel , " currencypack_" ) != - 1
943993 || StrEqual (szModel , " models/items/plate_robo_sandwich.mdl" )
944994 || StrEqual (szModel , " models/items/plate_sandwich_xmas.mdl" )
945- || StrEqual (szModel , " models/items/plate.mdl" ))
995+ || StrEqual (szModel , " models/items/plate.mdl" )
996+ || StrEqual (szModel , " models/effects/sentry1_muzzle/sentry1_muzzle.mdl" ))
946997 {
947998 SetEntProp (entity , Prop_Send , " m_nSequence" , 0 );
948999
@@ -972,6 +1023,17 @@ bool SetAnimation(int entity)
9721023
9731024 return true ;
9741025 }
1026+ else if (StrEqual (szModel , " models/effects/splode.mdl" )
1027+ || StrEqual (szModel , " models/effects/splodeglass.mdl" ))
1028+ {
1029+ SetEntProp (entity , Prop_Send , " m_nSequence" , 0 );
1030+
1031+ SetVariantString (" anim" );
1032+ AcceptEntityInput (entity , " SetAnimation" );
1033+ AcceptEntityInput (entity , " Enable" );
1034+
1035+ return true ;
1036+ }
9751037
9761038 return false ;
9771039}
0 commit comments