
Posted by FuzzySteve (195.92.194.*) on April
18, 1999 at 20:55:30:
Add this near the top of
g_items.c (or another file and prototype it there)
qboolean Pickup_General
(edict_t *ent, edict_t *other)
{
other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
return true;
}
This is a very easy one to
modify. if you want something to be able to be picked up by one team only, set
a new variable in g_local.h in the edict_t struct. when the item is spawned set
it to a team number, and add a check to the code above to see if the players
team number matches the variable set in the item. If it doesn't return false.
if you want a limited number to be allowed to be picked up, check the players
inventory and if it has more than the nummber you want to be picked up return
false. and example is below
qboolean Pickup_General (edict_t *ent, edict_t *other)
{
if
((Q_stricmp(ent->classname,"item_healthpack")==0) &
(other->client->pers.inventory[ITEM_INDEX(ent->item)]<5)){
other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
return true;
}
return false;
}
if
the player has 5 item_healthpack (one i created) , then it will not be picked
up.