This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

kill entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 06-19-2011 , 18:04   kill entity
Reply With Quote #1

I need to kill the entity. I do not know its id, but I know it targetname.

I'm looking for something like this:
PHP Code:
DispatchKeyValue(b"OnBreak""entity1,Kill,,0,-1"); 
This method destroys the entity with targetname "entity1"
But how do I do that I can fulfill this condition without assistance b OnBreak.

PHP Code:
KillEntity(targetname)
{
  
decl String:Buffer[64];     
  
Format(Buffersizeof(Buffer), "\"%s,Kill,,0,-1\""targetname);
  
//AcceptEntityInput(Buffer);

The way to check all ID does not suit me. Need a way without using the id

I tried using AcceptEntityInput but it does not understand targetname and necessary entity id
thanks
Nail is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-19-2011 , 18:30   Re: kill entity
Reply With Quote #2

You have to loop trough all entities and check each target name until
you have the right one.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 06-19-2011 , 19:29   Re: kill entity
Reply With Quote #3

Or if you know at least its class, loop with FindEntityByClassname.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 06-19-2011 , 20:09   Re: kill entity
Reply With Quote #4

No, it does not suit me. The problem is that the entity that I want to kill does not have an id (Entity index) at all. When another entity is created it is assigned this Entity index. And when I try to kill the desired entity, I kill another. I tried to check all entity indexs, but none of them is the desired. If I aim at the entity, directly in the game, I see it tagetname, but I see no id

Last edited by Nail; 06-19-2011 at 20:16.
Nail is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 06-19-2011 , 20:15   Re: kill entity
Reply With Quote #5

Quote:
Originally Posted by Nail View Post
No, it does not suit me. The problem is that the entity that I want to kill does not have an id (Entity index) at all.
hows that possible
Zephyrus is offline
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 06-19-2011 , 20:23   Re: kill entity
Reply With Quote #6

I do not know how it happens. I checked the new entity that uses this id, and it always weapon_knife or other weapon or the player or player-ragdoll. This happens when the game comes a new player and spawn in the middle of the round

Last edited by Nail; 06-19-2011 at 20:25.
Nail is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 06-19-2011 , 20:26   Re: kill entity
Reply With Quote #7

Quote:
Originally Posted by Nail View Post
I do not know how it happens. I checked the new entity that uses this id, and it always weapon_knife or other weapon or the player or player-ragdoll. This happens when the game comes a new player and spawn in the middle of the round
try using ent references

native EntRefToEntIndex(ref);
native EntIndexToEntRef(entity);
Zephyrus is offline
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 06-19-2011 , 20:31   Re: kill entity
Reply With Quote #8

I have tried. obtained -1, obtain that entity has been destroyed, but in fact I see it, and I can get it targetname. But I can not get the entity index.

The only way to destroy it using a other entity
DispatchKeyValue(b, "OnBreak", "entity1,Kill,,0,-1");
no other solution?

Last edited by Nail; 06-19-2011 at 20:34.
Nail is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 06-19-2011 , 20:35   Re: kill entity
Reply With Quote #9

strange
Zephyrus is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-20-2011 , 07:22   Re: kill entity
Reply With Quote #10

How about setting
PHP Code:
DispatchKeyValue(anyentity"OnUser1""yourtargetname,Kill,,0,-1");
AcceptEntityInput(anyentity"FireUser1"); 
__________________
Peace-Maker 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 13:50.


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