/** * @brief Spawns an item to the ground container */ static void SP_misc_item (edict_t *ent) { if (!ent->item) { gi.DPrintf("No item defined in misc_item\n"); G_FreeEdict(ent); return; } G_AddItemToFloor(ent->pos, ent->item); /* now we can free the original edict */ G_FreeEdict(ent); }
static void SVCmd_AddItem_f (void) { const int team = TEAM_DEFAULT; Actor* actor = G_EdictsGetNextLivingActorOfTeam(nullptr, team); if (gi.Cmd_Argc() < 3) { gi.DPrintf("Usage: %s <item-id>\n", gi.Cmd_Argv(1)); return; } if (!actor) { gi.DPrintf("Could not add item, no living members of team %i left\n", team); return; } G_AddItemToFloor(actor->pos, gi.Cmd_Argv(2)); }