Eh.... well, I was screwing around with metamod... thought about 'giving' weapons...
Anyway, I need help lol..
This is the code (ripped from hlsdk
*i r newb*)
Code:
void GiveNamedItem(edict_t *pEdict, const char *pszName)
{
if(strncmp(pszName,"tf_weapon_",10)==0)
{
edict_t *pent;
int istr=MAKE_STRING(pszName);
pent=CREATE_NAMED_ENTITY(istr);
if(FNullEnt(pent))
{
ALERT(at_console, "NULL Ent in GiveNamedItem!\n");
return;
}
VARS(pent)->origin=VARS(pEdict)->origin;
pent->v.spawnflags |=SF_NORESPAWN;
gpGamedllFuncs->dllapi_table->pfnSpawn(pent);
gpGamedllFuncs->dllapi_table->pfnTouch(pent, pEdict);
}
}
Anyway, it GIVES the weapon... I see the pickup hud item, and it's in my inventory, but I can't select it. If I have crowbar out, and I press '5' to select rpg, then it acts like it's selecting the RPG, but instead it reselect the crowbar... :-/
Any ideas?
Thanks for any help. I suck at C++ :-/