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

[ANY]Simple Object Remover


Post New Thread Reply   
 
Thread Tools Display Modes
Author
weld.inclusion
Junior Member
Join Date: Feb 2012
Plugin ID:
2830
Plugin Version:
1.0.1
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    remove an object
    Old 03-07-2012 , 16:23   [ANY]Simple Object Remover
    Reply With Quote #1

    Simple Object Remover

    This is a very simple object remover. I could not find this available already so I went ahead and wrote one. I have since found that some of the L4D2 fort builder/object spawner tools includes a similar function, but this is a much smaller plugin and as far as I can tell is not game specific. Some of this code is from Zuko's
    [L4D/L4D2] Weapon/Zombie Spawner, in which I believe the relevant sections were from antihacker's L4D Spawn Minigun plugin. Similar to [ANY] Ent_Delete Plugin but does not require sv_cheats 1 and does not provide non-admins with command.

    Commands
    There is only one command at present: sm_removeobject
    This will remove the object you are pointing at unless it is a client. It requires the root admin flag.

    Changelog

    1.0.1 Reverted to 1.0.1 - Witch crash unrelated 3/8/2012
    1.0.2 Logic to block a crash case - may be unnecessary, blocks removal of witch in L4D2 3/8/2012
    1.0.1 Rewrite verbosity string formats to print client names rather than storing names in a separate buffer 3/8/2012
    1.0 submitted for review 3/7/2012[B]
    Attached Files
    File Type: sp Get Plugin or Get Source (objectremover.sp - 891 views - 1.6 KB)
    __________________
    Weld

    Last edited by weld.inclusion; 12-08-2015 at 09:55. Reason: removal of plans section
    weld.inclusion is offline
    Sev
    Veteran Member
    Join Date: May 2010
    Old 03-07-2012 , 18:36   Re: [ANY]Simple Object Remover
    Reply With Quote #2

    Does this feature a save featue so you don't have to do it over and over?

    If not can you provide a save feature which will save to a cfg then can be safely removed later on to restore the default objects?
    Sev is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 03-07-2012 , 18:51   Re: [ANY]Simple Object Remover
    Reply With Quote #3

    for client names, you can just use the %N

    PHP Code:
    PrintToChatAll("[SM] %N tried to remove an invalid object."client); 
    __________________
    View my Plugins | Donate

    Last edited by TnTSCS; 03-07-2012 at 18:51.
    TnTSCS is offline
    weld.inclusion
    Junior Member
    Join Date: Feb 2012
    Old 03-07-2012 , 19:13   Re: [ANY]Simple Object Remover
    Reply With Quote #4

    Quote:
    Originally Posted by Sev View Post
    Does this feature a save featue so you don't have to do it over and over?

    If not can you provide a save feature which will save to a cfg then can be safely removed later on to restore the default objects?
    It has one feature so far, and that is the command.

    I suppose it is possible to work in some further features but I expect that functionality for saving/loading a cfg will be a long time coming and may be available in some of the bulkier build plugins but I'd have to check.

    I will add this to the todo list.

    @TnTSCS, thanks a ton - that is what I was missing and will save me a buffer.
    __________________
    Weld
    weld.inclusion is offline
    thetwistedpanda
    Good Little Panda
    Join Date: Sep 2008
    Old 03-07-2012 , 19:37   Re: [ANY]Simple Object Remover
    Reply With Quote #5

    Sev, it's easier to use Stripper: Source if you want an object deleted every time.
    __________________
    thetwistedpanda is offline
    Sev
    Veteran Member
    Join Date: May 2010
    Old 03-07-2012 , 19:40   Re: [ANY]Simple Object Remover
    Reply With Quote #6

    Doesn't require the use of hammer to use the maps to be able to edit them?

    I'm not very hammer friendly if so.

    Last edited by Sev; 03-07-2012 at 19:41.
    Sev is offline
    weld.inclusion
    Junior Member
    Join Date: Feb 2012
    Old 03-07-2012 , 19:44   Re: [ANY]Simple Object Remover
    Reply With Quote #7

    Quote:
    Originally Posted by Sev View Post
    Doesn't require the use of hammer to use the maps to be able to edit them?

    I'm not very hammer friendly if so.
    No - this plugin does not edit maps (e.g. will not remove a wall) but if it is aimed and fired at an entity like a chair or other physics object, it will remove it.

    Stripper:Source is definitely better for saving specific item removals for maps.
    __________________
    Weld
    weld.inclusion is offline
    weld.inclusion
    Junior Member
    Join Date: Feb 2012
    Old 03-08-2012 , 00:41   Re: [ANY]Simple Object Remover
    Reply With Quote #8

    1.0.1 Update to remove superfluous name buffer.
    __________________
    Weld

    Last edited by weld.inclusion; 03-08-2012 at 00:52.
    weld.inclusion is offline
    weld.inclusion
    Junior Member
    Join Date: Feb 2012
    Old 03-08-2012 , 01:22   Re: [ANY]Simple Object Remover
    Reply With Quote #9

    Just found a major error with L4D2 - will crash when the object to remove is a witch. Will need to debug.
    Looks like it may be a conflict with another plugin - need more testing.
    Rewrote logic to block attempt to remove witch.

    Edit: I expect the following to be more succinct way of including the witch test but I could not write it compilably at 2AM. I will test this when I can and see.
    Code:
    #include <sourcemod>
    #include <sdktools>
    #define VERSION "1.0.2"
    
    public Plugin:myinfo =
    {
        name = "Object Remover",
        author = "Weld Inclusion",
        description = "Removes an object where aimed.",
        version = VERSION,
        url = "http://forums.alliedmods.net/showthread.php?t=179911"
    }
    public OnPluginStart()
    {
        //Rewrite with CheckCommandAccess and CheckAccess to remove flag necessity
        //Register the command for use
        RegAdminCmd("sm_removeobject", Command_RemoveObject, ADMFLAG_ROOT, "Remove Object.");
    }
    
    public Action:Command_RemoveObject(client, args)
    {
        if(!client)
        {
        PrintToServer("Client is invalid");
        return Plugin_Handled;
        }
    
        RemoveObject(client);
        return Plugin_Handled;
    }
    
    public RemoveObject(client)
    {
        
        decl String:Target[128];
        //Get the object where the client is looking
        new object = GetClientAimTarget(client, false);
    
        GetEdictClassname(object, Target, sizeof(Target));
            
        if ((object == -1)||(!IsValidEntity(object))||(StrEqual(Target, "witch", false)))
        {
        ShowActivity2(client, "[SM] ", "%N tried to remove an invalid object.", client);
        LogAction(client, -1, "%N tried to remove an invalid object.", client);
        return;
        }
        else 
        {
        
    //Check if the object is a client and show activity if so.
        if (object > 0 && object <= GetMaxClients())
                {
        ShowActivity2(client, "[SM] ", "%N tried to remove %N", client, object);
        LogAction(client, object, "%N tried to remove %N", client, object);
        return;
        }
        ShowActivity2(client, "[SM] ", "%N removed %s", client, Target);
        LogAction(client, object, "%N removed %s", client, Target);
        AcceptEntityInput(object, "kill", -1, -1, -1);
        }
    }
    I have been informed that the witch issue is likely not an issue with this plugin.
    I have removed the witch check (back to 1.0.1).
    __________________
    Weld

    Last edited by weld.inclusion; 03-08-2012 at 10:34.
    weld.inclusion 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 16:08.


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