
A weapon that doesn nothing may seem pointless,
and in many ways it is, but I've had problems with starting people off without
a weapon when they want to change to one they've just picked up. So here is a
weapon that does nothing except print a message on the users screen
Add this into the item definitions in g_item.c
{"weapon_null", // The map entity name. dont include this in a map whatever you do.NULL, // The pickup functionUse_Weapon, // How to useNULL, // the drop functionWeapon_Null, //What the use function is"misc/w_pkup.wav","models/nullweapon.md2",0,"models/nullweapon.md2", //The models stuff. nullweapon.md2 is linked to at the end of the tutorial."w_blaster", //Icon to be used. you could create another, you probably should"No Weapon", //Pickup name. use this to give the item to someone at the start of the game0,0,NULL,IT_WEAPON|IT_STAY_COOP,WEAP_BLASTER, // the model index, just an integer defined in g_local.hNULL,0,""},
Add
void Weapon_Null(edict_t *ent);
at the top of g_items.c after the other Weapon_* function
defintions.
Add the code below at the end of p_weapon.c. you could make
this a seperate file if you really wanted
void Weapon_Null(edict_t *ent){if ((ent->client->buttons|ent->client->buttons) & (BUTTON_ATTACK|BUTTON_USE)){gi.centerprintf(ent,"You're not in the game yet, Select a class");return;}if (ent->client->newweapon)ChangeWeapon(ent);}
Resources