[Request] Access Entities via targetname
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.
|
Re: [Request] Access Entities via targetname
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).
|
Re: [Request] Access Entities via targetname
Thx Duke, i am goin try this ;)
|
Re: [Request] Access Entities via targetname
you will still only be limited to edicts....
|
Re: [Request] Access Entities via targetname
What's the difference? And it seems, that it doesn't work. Maybe i am to stupid to compare the strings... :( Its really frustrating...
|
Re: [Request] Access Entities via targetname
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...
|
Re: [Request] Access Entities via targetname
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.
|
Re: [Request] Access Entities via targetname
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); |
Re: [Request] Access Entities via targetname
Thx :) But i may not be able to use it. I am working on hl2mp...
|
Re: [Request] Access Entities via targetname
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.
|
Re: [Request] Access Entities via targetname
I wrote this function to do the job:
PHP Code:
However, I have a slight guess that StrEqual is faster than strcmp for checking if strings are equal, so if anyone can confirm this please, as I am too lazy to benchmark them :wink: The function returns either the index of the first entity found by that targetname, or -1 if not found. And of course this is also limited to entities that have an index, but it works well for stuff like physics objects or triggers... |
Re: [Request] Access Entities via targetname
that's almost the same thing....non networked entities usually don't have an index that's the whole point of it.
|
| All times are GMT -4. The time now is 18:08. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.