FlacoBey

Untitled

Jan 11th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.91 KB | None | 0 0
  1. #include sdktools
  2. #include sdkhooks
  3.  
  4. int tank;
  5. Handle sdkOnStaggered;
  6. Handle distance;
  7. public OnPluginStart()
  8. {
  9.     distance    = CreateConVar("sv_rang_rock_stun", "400.0", "", FCVAR_NONE);
  10.     Handle hGameConf = LoadGameConfigFile("BHaType");
  11.    
  12.     StartPrepSDKCall(SDKCall_Player);
  13.     PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CTerrorPlayer_OnStaggered");
  14.     PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
  15.     PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
  16.     sdkOnStaggered = EndPrepSDKCall();
  17.     if(sdkOnStaggered == INVALID_HANDLE)
  18.         {
  19.             SetFailState("Unable to find the 'CTerrorPlayer_Fling' signature, check the file version!");
  20.         }  
  21.     HookEvent("ability_use", ability_use);
  22. }
  23.  
  24. public Action ability_use(Event event, const char[] name, bool dontBroadcast)
  25. {
  26.     decl String:s[32];
  27.     GetEventString(event, "ability", s, 32);
  28.  
  29.     if(StrEqual(s, "ability_throw", true))
  30.     {  
  31.         tank = GetClientOfUserId(GetEventInt(event, "userid"));
  32.     }
  33. }
  34.  
  35. public OnEntityCreated(entity, const String:classname[])
  36. {
  37.     if(StrEqual(classname, "tank_rock", true)  )
  38.     {
  39.         if(IsValidEntity(entity) && IsValidEdict(entity))
  40.         {
  41.             if(GetEntityFlags(tank) & FL_ONFIRE)
  42.             {
  43.                 IgniteEntity(entity, 30.0);
  44.             }
  45.         }
  46.     }
  47. }
  48.  
  49. public OnEntityDestroyed(entity)
  50. {
  51.     if(!IsValidEntity(entity))return;  
  52.     decl String:g_classname[20];
  53.     GetEdictClassname(entity, g_classname, 20);
  54.     if(StrEqual(g_classname, "tank_rock", true))
  55.     {
  56.         if(IsValidEntity(entity) && IsValidEdict(entity))
  57.         {
  58.             for(int i = 1; i <= MaxClients; ++i)
  59.             {
  60.                 float fDamagerPos[3], fDangerPos[3];
  61.                 GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fDamagerPos);
  62.                 GetEntPropVector(i, Prop_Send, "m_vecOrigin", fDangerPos);
  63.                 float fTargetDistance = GetVectorDistance(fDamagerPos, fDangerPos);
  64.                 if (fTargetDistance > GetConVarFloat(distance)) continue;
  65.            
  66.                 SDKCall(sdkOnStaggered, i, entity, fDamagerPos);
  67.             }
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment