Raised This Month: $ Target: $400
 0% 

Remove entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 03-01-2015 , 13:45   Remove entity
Reply With Quote #1

Hello guys. How i can remove point_servercommand by stock? I have this code, but its not work.

PHP Code:
stock RemovePointCommand()
{
    new 
point = -1;
    while ((
point FindEntityByClassname(point"point_servercommand")) != -1)
        if (
IsValidEdict(point))
            
RemoveEdict(point);      

Whats wrong with him? thanks in advance.
keygens is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 03-01-2015 , 13:53   Re: Remove entity
Reply With Quote #2

This should work
PHP Code:
#include <sourcemod>

stock RemovePointCommand()
{
    new 
iEnt;
    while ((
iEnt FindEntityByClassname(iEnt"point_servercommand")) != -1) {
        
AcceptEntityInput(iEnt"Kill");
    }

Darkness_ is offline
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 03-01-2015 , 13:58   Re: Remove entity
Reply With Quote #3

Quote:
Originally Posted by Darkness_ View Post
This should work
PHP Code:
#include <sourcemod>

stock RemovePointCommand()
{
    new 
iEnt;
    while ((
iEnt FindEntityByClassname(iEnt"point_servercommand")) != -1) {
        
AcceptEntityInput(iEnt"Kill");
    }


Hmm...not work too.
keygens is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-01-2015 , 14:00   Re: Remove entity
Reply With Quote #4

when are you firing RemovePointCommand()
Why not just handle it OnEntityCreated().

Last edited by Mitchell; 03-01-2015 at 14:00.
Mitchell is offline
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 03-01-2015 , 14:11   Re: Remove entity
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
when are you firing RemovePointCommand()
Why not just handle it OnEntityCreated().

Into OnPluginStart and OnMapStart - zero effect. OnEntityCreated like this?

PHP Code:
public OnEntityCreated(edict, const String:classname[])
{
    if (
IsValidEdict(edict) && IsValidEntity(edict) && StrEqual(classname"point_servercommand"))
    {
        
AcceptEntityInput(edict"Kill");
    }


Last edited by keygens; 03-01-2015 at 14:12.
keygens is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-01-2015 , 14:36   Re: Remove entity
Reply With Quote #6

Quote:
Originally Posted by keygens View Post
Into OnPluginStart and OnMapStart - zero effect. OnEntityCreated like this?

PHP Code:
public OnEntityCreated(edict, const String:classname[])
{
    if (
IsValidEdict(edict) && IsValidEntity(edict) && StrEqual(classname"point_servercommand"))
    {
        
AcceptEntityInput(edict"Kill");
    }

Well since the entity has yet to spawn you shouldn't check if it's valid.
PHP Code:
#include <sdkhooks>
public OnEntityCreated(entity, const String:classname[]) {
    if(
StrEqual(classname"point_servercommand")) {
        
SDKHook(entitySDKHook_SpawnHook_OnEntitySpawn);
    }
}
public 
Action:Hook_OnEntitySpawn(entity) {
    return 
Plugin_Handled;

Mitchell is offline
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 03-01-2015 , 14:44   Re: Remove entity
Reply With Quote #7

Quote:
Originally Posted by Mitchell View Post
Well since the entity has yet to spawn you shouldn't check if it's valid.
PHP Code:
#include <sdkhooks>
public OnEntityCreated(entity, const String:classname[]) {
    if(
StrEqual(classname"point_servercommand")) {
        
SDKHook(entitySDKHook_SpawnHook_OnEntitySpawn);
    }
}
public 
Action:Hook_OnEntitySpawn(entity) {
    return 
Plugin_Handled;

Thank you!
keygens is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 03-02-2015 , 14:16   Re: Remove entity
Reply With Quote #8

Just use something to run the cmd "ent_fire point_clientcommand kill" or "ent_fire point_servercommand kill"
Brrdy is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-02-2015 , 14:18   Re: Remove entity
Reply With Quote #9

Quote:
Originally Posted by Brrdy View Post
Just use something to run the cmd "ent_fire point_clientcommand kill" or "ent_fire point_servercommand kill"
or just use what I posted, as he said, thank you I assumed it worked.
And your solution would be horrible, as it woulds still have the issue of when to fire those commands.
Plus you could just use stripper: source.
Mitchell is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 03-02-2015 , 14:20   Re: Remove entity
Reply With Quote #10

Quote:
Originally Posted by Mitchell View Post
or just use what I posted, as he said, thank you I assumed it worked.
And your solution would be horrible, as it woulds still have the issue of when to fire those commands.
Plus you could just use stripper: source.
I suppose
Just giving more help in case yours doesn't work
Brrdy 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 18:09.


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