Raised This Month: $12 Target: $400
 3% 

Chicken Cleanup


Post New Thread Reply   
 
Thread Tools Display Modes
Author
usla
Senior Member
Join Date: Jul 2009
Plugin ID:
5413
Plugin Version:
1.0
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Removes any spawned chickens every 5 seconds.
    Old 11-16-2016 , 10:51   Chicken Cleanup
    Reply With Quote #1

    Chicken seem to respawn after some time in csgo and using stripper to kill pet_entity or chicken won't work. This plugin should check map every 5 seconds for any chickens and remove them.
    Attached Files
    File Type: sp Get Plugin or Get Source (chicken_cleanup.sp - 1067 views - 653 Bytes)
    File Type: smx chicken_cleanup.smx (4.1 KB, 309 views)
    usla is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 11-16-2016 , 11:15   Re: Chicken Cleanup
    Reply With Quote #2

    Might as well hook OnEntityCreated and hook the entity spawn.
    Also it would be nice to determine if it was the map that spawned the chicken or if it was another plugin.
    Mitchell is offline
    SM9
    Veteran Member
    Join Date: Sep 2013
    Location: United Kingdom
    Old 11-16-2016 , 11:49   Re: Chicken Cleanup
    Reply With Quote #3

    Code to remove them after they have spawned (Safest method)

    PHP Code:
    #include <sdktools>
    #include <sdkhooks>

    public void OnEntityCreated(int iEntity, const char[] szClassName)
    {
        if(
    StrContains(szClassName"chicken"false) == -1) {
            return;
        }
        
        
    SDKHook(iEntitySDKHook_SpawnPostHook_ChickenSpawned);
    }

    public 
    void Hook_ChickenSpawned(int iChicken)
    {
        if(!
    IsValidEntity(iChicken)) {
            return;
        }
        
        
    AcceptEntityInput(iChicken"Kill");

    Attached Files
    File Type: sp Get Plugin or Get Source (chicken_cleanup.sp - 769 views - 396 Bytes)

    Last edited by SM9; 11-16-2016 at 15:35.
    SM9 is offline
    SM9
    Veteran Member
    Join Date: Sep 2013
    Location: United Kingdom
    Old 11-16-2016 , 15:35   Re: Chicken Cleanup
    Reply With Quote #4

    Experimental code to prevent them spawning, (Could be bad)

    PHP Code:
    #include <sdktools>
    #include <sdkhooks>

    public void OnEntityCreated(int iEntity, const char[] szClassName)
    {
        if(
    StrContains(szClassName"chicken"false) == -1) {
            return;
        }
        
        
    SDKHook(iEntitySDKHook_SpawnHook_ChickenSpawned);
    }

    public 
    Action Hook_ChickenSpawned(int iChicken) {
        if(
    IsValidEntity(iChicken)) {
            
    AcceptEntityInput(iChicken"Kill");
        }
        
        return 
    Plugin_Stop;

    Attached Files
    File Type: sp Get Plugin or Get Source (chicken_cleanup.sp - 724 views - 404 Bytes)

    Last edited by SM9; 11-16-2016 at 15:37.
    SM9 is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 11-16-2016 , 16:00   Re: Chicken Cleanup
    Reply With Quote #5

    If you're going to prevent it from spawning then you shouldn't attempt to kill an entity that hasn't even spawned yet, denying the spawn should remove the entity.
    Mitchell is offline
    usla
    Senior Member
    Join Date: Jul 2009
    Old 11-16-2016 , 16:05   Re: Chicken Cleanup
    Reply With Quote #6

    killing pet_entity won't prevent chickens from respawning either, this way works
    usla is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 11-16-2016 , 16:14   Re: Chicken Cleanup
    Reply With Quote #7

    Quote:
    Originally Posted by usla View Post
    killing pet_entity won't prevent chickens from respawning either, this way works
    pet_entity doesn't really work in source, as it's just a frame for the chicken entity.
    OnEntityCreated is called when ever the entity is created, eve in the middle of the round.

    Last edited by Mitchell; 11-16-2016 at 16:14.
    Mitchell is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 07:39.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode