Alright, I am trying to convert TSX's ts_spawnweapon function to work with Metamod instead of Engine. I have ran into a problem though. When I execute this function nothing happens. No errors show up in the server console or anything. What could be the problem?
Code:
/*
Weapon Spawns
*/
stock ts_spawnweapon(weaponid[],duration[],extraclip[],spawnflags[],Float:Origin[3]) {
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "ts_groundweapon"));
dllfunc(DLLFunc_Spawn, ent);
set_keyvalue(ent,"tsweaponid",weaponid);
set_keyvalue(ent,"wduration",duration);
set_keyvalue(ent,"wextraclip",extraclip);
set_keyvalue(ent,"spawnflags",spawnflags);
engfunc(EngFunc_SetOrigin, ent, Origin);
return PLUGIN_HANDLED;
}
/*
Set Keyvalue - Coded by Basic-Master
*/
stock set_keyvalue(ent, key[], value[]) {
new classname[32]
pev(ent, pev_classname, classname, 31)
set_kvd(0, KV_ClassName, classname)
set_kvd(0, KV_KeyName, key)
set_kvd(0, KV_Value, value)
set_kvd(0, KV_fHandled, 0)
dllfunc(DLLFunc_KeyValue, ent, 0)
}