|
3 | 3 | #define DEBUG |
4 | 4 |
|
5 | 5 | #define PLUGIN_AUTHOR "BattlefieldDuck" |
6 | | -#define PLUGIN_VERSION "5.2" |
| 6 | +#define PLUGIN_VERSION "5.3" |
7 | 7 |
|
8 | 8 | #include <sourcemod> |
9 | 9 | #include <sdkhooks> |
@@ -87,6 +87,8 @@ float g_fGrabDistance[MAXPLAYERS + 1]; //Distance between the client eye and ent |
87 | 87 | float g_oldfEntityPos[MAXPLAYERS + 1][3]; |
88 | 88 | float g_fEntityPos[MAXPLAYERS + 1][3]; |
89 | 89 |
|
| 90 | +MoveType g_mtOriginal[MAXPLAYERS + 1]; |
| 91 | + |
90 | 92 | float g_fRotateCD[MAXPLAYERS + 1]; |
91 | 93 | float g_fCopyCD[MAXPLAYERS + 1]; |
92 | 94 |
|
@@ -253,6 +255,7 @@ public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast |
253 | 255 | if(client > 0 && client <= MaxClients && IsClientInGame(client)) |
254 | 256 | { |
255 | 257 | TF2_RegeneratePlayer(client); |
| 258 | + g_mtOriginal[client] = GetEntityMoveType(client); |
256 | 259 | } |
257 | 260 | } |
258 | 261 |
|
@@ -338,7 +341,7 @@ float[] GetPointAimPosition(float pos[3], float angles[3], float maxtracedistanc |
338 | 341 | if(TR_DidHit(trace)) |
339 | 342 | { |
340 | 343 | int entity = TR_GetEntityIndex(trace); |
341 | | - if (entity > MaxClients && (Build_ReturnEntityOwner(entity) == client || CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC))) |
| 344 | + if ((Build_ReturnEntityOwner(entity) == client || CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC))) |
342 | 345 | { |
343 | 346 | g_iAimingEntityRef[client] = EntIndexToEntRef(entity); |
344 | 347 |
|
@@ -377,8 +380,7 @@ public bool TraceEntityFilter(int entity, int mask, int client) |
377 | 380 | return (IsValidEntity(entity) |
378 | 381 | && entity != client |
379 | 382 | && entity != EntRefToEntIndex(g_iGrabEntityRef[client]) |
380 | | - && entity != EntRefToEntIndex(g_iGrabPointRef[client]) |
381 | | - && MaxClients < entity); |
| 383 | + && entity != EntRefToEntIndex(g_iGrabPointRef[client])); |
382 | 384 | } |
383 | 385 |
|
384 | 386 | float[] GetAngleYOnly(const float angles[3]) |
@@ -754,9 +756,15 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3], |
754 | 756 | //Set entity velocity to 0 |
755 | 757 | char szClass[32]; |
756 | 758 | GetEdictClassname(iEntity, szClass, sizeof(szClass)); |
757 | | - if(StrEqual(szClass, "prop_physics") || StrEqual(szClass, "tf_dropped_weapon")) |
| 759 | + if(StrEqual(szClass, "prop_physics") || StrEqual(szClass, "tf_dropped_weapon") || (iEntity > 0 && iEntity <= MaxClients)) |
758 | 760 | { |
759 | 761 | TeleportEntity(iEntity, NULL_VECTOR, NULL_VECTOR, ZERO_VECTOR); |
| 762 | + |
| 763 | + if(iEntity > 0 && iEntity <= MaxClients && IsClientInGame(iEntity) && IsPlayerAlive(iEntity)) |
| 764 | + { |
| 765 | + g_mtOriginal[iEntity] = GetEntityMoveType(iEntity); |
| 766 | + SetEntityMoveType(iEntity, MOVETYPE_NONE); |
| 767 | + } |
760 | 768 | } |
761 | 769 |
|
762 | 770 | //Set entity Outline |
@@ -1066,8 +1074,13 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3], |
1066 | 1074 | //Apply velocity |
1067 | 1075 | char szClass[32]; |
1068 | 1076 | GetEdictClassname(entity, szClass, sizeof(szClass)); |
1069 | | - if(StrEqual(szClass, "prop_physics") || StrEqual(szClass, "tf_dropped_weapon")) |
| 1077 | + if(StrEqual(szClass, "prop_physics") || StrEqual(szClass, "tf_dropped_weapon") || (entity > 0 && entity <= MaxClients)) |
1070 | 1078 | { |
| 1079 | + if(entity > 0 && entity <= MaxClients && IsClientInGame(entity) && IsPlayerAlive(entity)) |
| 1080 | + { |
| 1081 | + SetEntityMoveType(entity, g_mtOriginal[entity]); |
| 1082 | + } |
| 1083 | + |
1071 | 1084 | float vector[3]; |
1072 | 1085 | MakeVectorFromPoints(g_oldfEntityPos[client], g_fEntityPos[client], vector); |
1073 | 1086 |
|
|
0 commit comments