Hello, I am working on a plugin to add more support to my game for maps that were not originally meant for my game, HLDM maps are very popular in TFC as they are open world deathmatches, I am trying to hook all of the weapons that the engine drops (because no equivalent item is in the engine for this game) and implement the closest equivalent I can find.. the problem is, I cant seem to grab any entities other than those that are added to the game (weapon_grenade) and I do know for a fact that these entities are in the map (bsp file contains the entity info)
I am properly hooking the function in plugin_precache and can confirm that it is running, and it even sends my data to the logfile I specified, however it only works for entities that it would normally spawn.. is there any way to achieve what I am trying to do?
PHP Code:
public plugin_precache()
{
//
register_forward(FM_KeyValue, "hook_KeyValue")
}
public hook_KeyValue(entId, kvd_id)
{
//
if(!pev_valid(entId))
return FMRES_HANDLED;
new className[64];
pev(entId, pev_classname, className, 63);
if (containi(className, "weapon_") !=-1)
{
new model[64], Float:origin[3]
pev(entId, pev_model, model, charsmax(model));
pev(entId, pev_origin, origin);
log_to_file("hldm.log", "Found entity %s with model %s, location: {%f, %f, %f}", className, model, origin[0], origin[1], origin[2])
}
return FMRES_IGNORED;
}
EDIT: I have achieved the value by using engine:
http://forums.alliedmods.net/showthr...=205578&page=2
PHP Code:
public pfn_keyvalue(entid)
{
new classname[32], key[32], value[32]
copy_keyvalue(classname, 31, key, 31, value, 31)
if( (equal(key, "classname")) && (containi(value, "weapon_") != -1) )
{
log_to_file("hldm.log", "Weapon_* Key: %s Value: %s", key, value);
//server_print("FOUND!")
//DispatchKeyValue("classname", "func_wall")
}
}
how will I be able to use this to get ther other keyvalues on this entity? I am going to try and change the if to a while and hope for good results.
__________________