Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- #pragma newdecls required
- #pragma semicolon 1
- public void OnEntityCreated(int entity, const char[] classname)
- {
- if(IsValidEntity(entity))
- {
- SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
- }
- }
- public void SpawnPost(int entity)
- {
- if(IsValidEntity(entity))
- {
- RequestFrame(NextFrame, EntIndexToEntRef(entity));
- }
- }
- public void NextFrame(int entity)
- {
- if(IsValidEntRef(entity))
- {
- entity = EntRefToEntIndex(entity);
- if (IsValidEntity(entity))
- {
- char sClsName[32];
- GetEntityClassname(entity, sClsName, sizeof(sClsName));
- if(StrContains(sClsName, "spawn") > -1)
- {
- if(StrContains(sClsName, "shotgun") > 1 || StrContains(sClsName, "rifle") > 1 || StrContains(sClsName, "sniper") || StrContains(sClsName, "smg") > 0)
- {
- DispatchKeyValue(entity, "count", "1");
- }
- }
- }
- }
- }
- bool IsValidEntRef(int iEnt)
- {
- if( iEnt && EntRefToEntIndex(iEnt) != INVALID_ENT_REFERENCE )
- return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment