I want to use StartTouch to detect when a player touches an entity or vice-versa so I can do something with either player or entity. Im having the problem of not being able to access the other's index.
I found
this thread, but that relates to a player touching a tank bot and I can't make it work for me. I don't have much code to go on because I don't know weather I should be hooking touch on the player or entity to start with. I would prefer to hook touch on the entity because the entity won't be moving around touching lots of other items, for example:
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public Action Spawn(char model[64], char origin[128])
{
int entity = CreateEntityByName("prop_physics_override");
DispatchKeyValue(entity, "count", "1");
DispatchKeyValue(entity, "collisions", "1");
DispatchKeyValue(entity, "spawnflags", "11");
DispatchKeyValue(entity, "origin", origin);
DispatchKeyValue(entity, "model", model);
DispatchSpawn(entity);
SDKHook(entity, SDKHook_StartTouch, Touch_Player);
}
public Action Touch_Player(int entity)
{
}