Code:
new tfdetect
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
new ent = find_ent_by_class(-1, "info_tfdetect");
if(ent)
remove_entity(ent);
tfdetect = create_entity("info_tfdetect");
if(tfdetect)
{
entity_set_string(tfdetect, EV_SZ_classname, "info_tfdetect");
DispatchKeyValue(tfdetect, "origin", "0 0 0");
DispatchKeyValue(tfdetect, "maxammo_shells", "1006");
DispatchKeyValue(tfdetect, "team1_name", "SuRf3rs!");
DispatchKeyValue(tfdetect, "hook_out", "0");
DispatchKeyValue(tfdetect, "ex_skill_max", "3");
DispatchKeyValue(tfdetect, "ex_skill_min", "1");
DispatchSpawn(tfdetect) // you was missing this vital part
}
}
/*
You shouldn't really need any of this below
public plugin_precache()
{
register_forward(FM_KeyValue, "forward_keyvalue");
}
public forward_keyvalue(ent2, kvdid)
{
if(!pev_valid(ent2))
return FMRES_IGNORED;
// You should have a classname check here for "info_tfdetect"
// else you're messing with every single entity that calls this function!
new keyname[128];
get_kvd(kvdid, KV_KeyName, keyname, 127);
if(equal(keyname, "origin"))
{
set_kvd(kvdid, KV_Value, "0 0 0");
}
else if(equal(keyname, "maxammo_shells"))
{
set_kvd(kvdid, KV_Value, "1006");
}
else if(equal(keyname, "team1_name"))
{
set_kvd(kvdid, KV_Value, "SuRf3rs!");
}
else if(equal(keyname, "hook_out"))
{
set_kvd(kvdid, KV_Value, "0");
}
else if(equal(keyname, "ex_skill_max"))
{
set_kvd(kvdid, KV_Value, "3");
}
else if(equal(keyname, "ex_skill_min"))
{
set_kvd(kvdid, KV_Value, "1");
}
return FMRES_IGNORED // at the end of function
}*/