Greetings, im having a bit of trouble "hooking" a triggerevent from an i_t_g entity from within TFC.
First of all, I did a test as you can see with the outcommented register_logevent, which calls the function "test", this works perfectly as expected.
When I try to call the function "cmdCam" instead, I get a bunch of errors:
PHP Code:
[ENGINE] Invalid player 0 (not in-game)
[AMXX] Run time error 10 (plugin "cam.amxx") (native "attach_view")
Can anyone see what im missing here?
PHP Code:
#include <amxmodx>
#include <engine>
new const pl_cm_class[] = "PlayerCamera"
public plugin_init()
{
register_logevent("cmdCam",3,"1=triggered", "2=SidescrollStart")
//register_logevent("test",3,"1=triggered", "2=SidescrollStart")
register_think(pl_cm_class,"Think_PlayerCamera")
}
public cmdCam(id)
Create_PlayerCamera(id)
Create_PlayerCamera(id)
{
new ent
while ((ent = find_ent_by_class(ent,pl_cm_class)) != 0)
{
if (entity_get_edict(ent,EV_ENT_owner) == id)
{
attach_view(id , ent)
return
}
}
ent = create_entity("info_target")
if( !ent )
return;
entity_set_string(ent, EV_SZ_classname, pl_cm_class)
entity_set_model(ent, "models/rpgrocket.mdl")
entity_set_byte(ent, EV_INT_solid, SOLID_TRIGGER)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLYMISSILE)
entity_set_edict(ent, EV_ENT_owner, id)
entity_set_int(ent,EV_INT_rendermode, kRenderTransTexture)
entity_set_float(ent, EV_FL_renderamt, 0.0 )
attach_view(id,ent)
entity_set_float(ent, EV_FL_nextthink, get_gametime())
}
public test(id)
{
client_print(id,print_chat, "TestTest")
return PLUGIN_CONTINUE;
}