Raised This Month: $ Target: $400
 0% 

[Request] Access Entities via targetname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obbi
Junior Member
Join Date: Jun 2007
Old 05-28-2008 , 10:33   [Request] Access Entities via targetname
Reply With Quote #1

I could need some help with the Entity I/O System. I'd like to send Inputs to an Entity with a predefined targetname. Is there any way to do this? Something that does the same as this example: ent_fire blobb kill Problem is, dedicated Server don't support ent_fire and the Sourcemod Entity Input System is kinda weird. It requires an Index, but I cannot figure it out, how to get it.
Obbi is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 05-28-2008 , 11:03   Re: [Request] Access Entities via targetname
Reply With Quote #2

In general terms, you need to loop through all of the entities (up to GetEntityCount) and check the targetname of the each entity. I believe you can use GetEntPropString to find the the m_target property. If the string returned matches your name (example: blobb) then use the AcceptEntityInput function to send the input (such as kill).
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
Obbi
Junior Member
Join Date: Jun 2007
Old 05-28-2008 , 13:03   Re: [Request] Access Entities via targetname
Reply With Quote #3

Thx Duke, i am goin try this ;)
Obbi is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-28-2008 , 14:56   Re: [Request] Access Entities via targetname
Reply With Quote #4

you will still only be limited to edicts....
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
Obbi
Junior Member
Join Date: Jun 2007
Old 05-28-2008 , 15:53   Re: [Request] Access Entities via targetname
Reply With Quote #5

What's the difference? And it seems, that it doesn't work. Maybe i am to stupid to compare the strings... Its really frustrating...
Obbi is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-28-2008 , 16:33   Re: [Request] Access Entities via targetname
Reply With Quote #6

edicts are networked entities just like players and most visible entities you could see in a game, there is entities like env_fog_controller which is not networked there for it doesn't have an edict, if it doesn't have an index then it doesn't have an index(integer #) therefor you can't really find that type of entities for now until the sourcemod dev team adds the feature to be able deal with non-networked entities...
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
Obbi
Junior Member
Join Date: Jun 2007
Old 05-28-2008 , 16:42   Re: [Request] Access Entities via targetname
Reply With Quote #7

D'oh! Okay then I'll have to wait for this. I need access to an logic_relay and I am really sure that I cannot access these by now. So far, thx for ur help.
Obbi is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 05-28-2008 , 18:08   Re: [Request] Access Entities via targetname
Reply With Quote #8

You can use my extension to add events to the event queue (basically exactly what ent_fire does): http://forums.alliedmods.net/showthread.php?t=69658

logic_auto has an entity index, but as Fredd said, I don't think logic_relays do.

You can easily do inputs on entities with the extension, something like:
Code:
dhEntFire("blobb", "kill", "", 0.0);
would remove all entities with a targetname of "blobb." You can also target entity types such as "player" or "logic_relay" (yes logic_relay works in this instance even if you can't reference it for SM functions).
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
Obbi
Junior Member
Join Date: Jun 2007
Old 05-28-2008 , 20:43   Re: [Request] Access Entities via targetname
Reply With Quote #9

Thx But i may not be able to use it. I am working on hl2mp...
Obbi is offline
Obbi
Junior Member
Join Date: Jun 2007
Old 07-04-2008 , 10:11   Re: [Request] Access Entities via targetname
Reply With Quote #10

I dont want to annoy but... It is important. Anybody? btw. LDuke, could u pls upload the sources 4 your Dukehacks?! Maybe there's a way to use the code for hl2mp.
Obbi 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 19:50.


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