ok... If you start by playing a map with sv_cheats 1 (against bots)
Use command: find_ent <classname>
- you need give a letter or else entity classname to get list of entities from map.
Example
find_ent _ or
find_ent door
I found func_door.
You can get some info how func_door works.
With command: ent_info <classname>
example
ent_info func_door
We can either
Open or
Kill func_door.
You can test in that sv_cheats 1 mode...
ent_fire func_door Open
- I don't remember, would this open all func_doors or just one...
Here SourceMod plugin sample.
When you aim different places and use command sm_test, it print to chat some info and opens func_door if found.
PHP Code:
#include <sdktools>
public void OnPluginStart()
{
RegConsoleCmd("sm_test", sm_test);
}
public Action sm_test(int client, int arg)
{
if(client == 0 || !IsClientInGame(client)) return Plugin_Handled;
int entity_index = GetClientAimTarget(client, false);
if(entity_index == -1)
{
PrintToChat(client, "[SM] No entities here...");
return Plugin_Handled;
}
char classname[MAX_NAME_LENGTH];
if(!GetEntityClassname(entity_index, classname, sizeof(classname)))
{
PrintToChat(client, "[SM] No 'classname', entity %i", entity_index);
return Plugin_Handled;
}
char targetname[MAX_NAME_LENGTH];
GetEntPropString(entity_index, Prop_Data, "m_iName", targetname, sizeof(targetname));
PrintToChat(client, "[SM] You found %s - %s - %i", classname, targetname, entity_index);
if(StrEqual(classname, "func_door", false)) AcceptEntityInput(entity_index, "Open");
return Plugin_Handled;
}
__________________