I've made a custom map and included a single trigger_camera entity with the targetname set to "KEYCAM" and don't want to set it off through the usual way by triggering it (not that it matters, since it's multiplayer cs 1.6), but would rather use the engine function and set the player's view to it instead.
When I trigger the engine function, the player's view gets to the center of the map (0, 0, 0) instead of the camera that is placed elsewhere. How do I resolve this issue? Note that I want it to be done programmatically and not through mapping.
PHP Code:
new g_ent;
public plugin_init() {
register_clcmd("say /cam", "CmdCam");
new ent = -1, tname[32];
while (ent = find_ent_by_class(ent, "trigger_camera")) {
pev(ent, pev_targetname, tname, charsmax(tname));
if (equal(tname, "KEYCAM")) {
g_ent = ent;
log_amx("Cam found: %d", ent);
break;
}
}
}
public CmdCam(id) {
engfunc(EngFunc_SetView, id, g_ent);
}