FlacoBey

Untitled

Jun 3rd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include sdktools
  2. #include sdkhooks
  3.  
  4. #pragma newdecls required
  5. #pragma semicolon 1
  6.  
  7. public void OnEntityCreated(int entity, const char[] classname)
  8. {
  9.     if(IsValidEntity(entity))
  10.     {
  11.         SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
  12.     }
  13. }
  14.  
  15. public void SpawnPost(int entity)
  16. {
  17.     RequestFrame(NextFrame, EntIndexToEntRef(entity));
  18. }
  19.  
  20. public void NextFrame(int entity)
  21. {
  22.     if(IsValidEntRef(entity))
  23.     {
  24.         entity = EntRefToEntIndex(entity);
  25.         if (IsValidEntity(entity))
  26.         {
  27.             char sClsName[32];
  28.             GetEntityClassname(entity, sClsName, sizeof(sClsName));
  29.             if(StrContains(sClsName, "spawn") > -1)
  30.             {
  31.                 if(StrContains(sClsName, "shotgun") > 1 || StrContains(sClsName, "rifle") > 1 || StrContains(sClsName, "sniper") || StrContains(sClsName, "smg") > 0)
  32.                 {
  33.                     DispatchKeyValue(entity, "count", "1");
  34.                 }
  35.             }
  36.         }
  37.     }
  38. }
  39.  
  40. bool IsValidEntRef(int iEnt)
  41. {
  42.     if( iEnt && EntRefToEntIndex(iEnt) != INVALID_ENT_REFERENCE )
  43.         return true;
  44.     return false;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment