• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ safe_cprintf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中safe_cprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ safe_cprintf函数的具体用法?C++ safe_cprintf怎么用?C++ safe_cprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了safe_cprintf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: debug_printf

///////////////////////////////////////////////////////////////////////
// Debug print, could add a "logging" feature to print to a file
///////////////////////////////////////////////////////////////////////
void debug_printf(char *fmt, ...)
{
	int     i;
	char	bigbuffer[0x10000];
	int		len;
	va_list	argptr;
	edict_t	*cl_ent;
	
	va_start (argptr,fmt);
	len = vsprintf (bigbuffer,fmt,argptr);
	va_end (argptr);

	if (dedicated->value)
		safe_cprintf(NULL, PRINT_MEDIUM, bigbuffer);

	for (i=0 ; i<maxclients->value ; i++)
	{
		cl_ent = g_edicts + 1 + i;
		if (!cl_ent->inuse || cl_ent->ai.is_bot)
			continue;

		safe_cprintf(cl_ent,  PRINT_MEDIUM, bigbuffer);
	}

}
开发者ID:emmamai,项目名称:vortex-indy,代码行数:28,代码来源:bot_common.c


示例2: Use_Weapon

/*
================
Use_Weapon

Make the weapon ready if there is ammo
================
*/
void Use_Weapon (edict_t *ent, gitem_t *item)
{
	int			ammo_index;
	gitem_t		*ammo_item;

	// see if we're already using it
	if (item == ent->client->pers.weapon)
		return;

	if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO))
	{
		ammo_item = FindItem(item->ammo);
		ammo_index = ITEM_INDEX(ammo_item);

		if (!ent->client->pers.inventory[ammo_index])
		{
			safe_cprintf (ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}

		if (ent->client->pers.inventory[ammo_index] < item->quantity)
		{
			safe_cprintf (ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}
	}

	// change to this weapon when down
	ent->client->newweapon = item;
}
开发者ID:ZwS,项目名称:qudos,代码行数:37,代码来源:p_weapon.c


示例3: SVCmd_AddIP_f

/*
=================
SV_AddIP_f
=================
*/
void SVCmd_AddIP_f (void)
{
	int		i;
	
	if (gi.argc() < 3) {
		safe_cprintf(NULL, PRINT_HIGH, "Usage:  addip <ip-mask>\n");
		return;
	}

	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].compare == 0xffffffff)
			break;		// free spot
	if (i == numipfilters)
	{
		if (numipfilters == MAX_IPFILTERS)
		{
			safe_cprintf (NULL, PRINT_HIGH, "IP filter list is full\n");
			return;
		}
		numipfilters++;
	}
	
	if (!StringToFilter (gi.argv(2), &ipfilters[i]))
		ipfilters[i].compare = 0xffffffff;
}
开发者ID:qbism,项目名称:qbq2,代码行数:30,代码来源:g_svcmds.c


示例4: SVCmd_WriteIP_f

/*
=================
SV_WriteIP_f
=================
*/
void SVCmd_WriteIP_f (void)
{
	FILE	*f;
	char	name[MAX_OSPATH];
	byte	b[4];
	int		i;
	cvar_t	*game;

	game = gi.cvar("game", "", 0);

	if (!*game->string)
		sprintf (name, "%s/listip.cfg", GAMEVERSION);
	else
		sprintf (name, "%s/listip.cfg", game->string);

	safe_cprintf (NULL, PRINT_HIGH, "Writing %s.\n", name);

	f = fopen (name, "wb");
	if (!f)
	{
		safe_cprintf (NULL, PRINT_HIGH, "Couldn't open %s\n", name);
		return;
	}
	
	fprintf(f, "set filterban %d\n", (int)filterban->value);

	for (i=0 ; i<numipfilters ; i++)
	{
		*(unsigned *)b = ipfilters[i].compare;
		fprintf (f, "sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
	}
	
	fclose (f);
}
开发者ID:qbism,项目名称:qbq2,代码行数:39,代码来源:g_svcmds.c


示例5: SVCmd_RemoveIP_f

/*
=================
SV_RemoveIP_f
=================
*/
void SVCmd_RemoveIP_f (void)
{
	ipfilter_t	f;
	int			i, j;

	if (gi.argc() < 3) {
		safe_cprintf(NULL, PRINT_HIGH, "Usage:  sv removeip <ip-mask>\n");
		return;
	}

	if (!StringToFilter (gi.argv(2), &f))
		return;

	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].mask == f.mask
		&& ipfilters[i].compare == f.compare)
		{
			for (j=i+1 ; j<numipfilters ; j++)
				ipfilters[j-1] = ipfilters[j];
			numipfilters--;
			safe_cprintf (NULL, PRINT_HIGH, "Removed.\n");
			return;
		}
	safe_cprintf (NULL, PRINT_HIGH, "Didn't find %s.\n", gi.argv(2));
}
开发者ID:qbism,项目名称:qbq2,代码行数:30,代码来源:g_svcmds.c


示例6: my_bprintf

void my_bprintf (int printlevel, char *fmt, ...)
{
	int i;
	char	bigbuffer[0x10000];
	int		len;
	va_list		argptr;
	edict_t	*cl_ent;

	va_start (argptr,fmt);
//	len = vsprintf (bigbuffer,fmt,argptr);
	len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt, argptr);
	va_end (argptr);

	if (dedicated->value)
		safe_cprintf(NULL, printlevel, bigbuffer);

	for (i=0 ; i<maxclients->value ; i++)
	{
		cl_ent = g_edicts + 1 + i;
		if (!cl_ent->inuse)
			continue;

		safe_cprintf(cl_ent, printlevel, bigbuffer);
	}
}
开发者ID:PBrookfield,项目名称:vrgamex86,代码行数:25,代码来源:g_utils.c


示例7: BombArea

void BombArea (edict_t *ent, float skill_mult, float cost_mult)
{
	vec3_t	angles, offset;
	vec3_t	forward, right, start, end;
	trace_t	tr;
	edict_t *bomb;
	int		cost=COST_FOR_BOMB*cost_mult;

#ifdef OLD_NOLAG_STYLE
	// 3.5 don't allow bomb area to prevent lag
	if (nolag->value)
	{
		safe_cprintf(ent, PRINT_HIGH, "Bomb area is temporarily disabled to prevent lag.\n");
		return;
	}
#endif

	AngleVectors (ent->client->v_angle, forward, right, NULL);
	VectorSet(offset, 0, 7, ent->viewheight-8);
	P_ProjectSource(ent->client, ent->s.origin, offset, forward, right, start);
	VectorMA(start, 8192, forward, end);
	tr = gi.trace(start, NULL, NULL, end, ent, MASK_SOLID);

	// make sure this is a floor
	vectoangles(tr.plane.normal, angles);
	ValidateAngles(angles);
	if (angles[PITCH] == FLOOR_PITCH)
	{
		VectorCopy(tr.endpos, start);
		VectorCopy(tr.endpos, end);
		end[2] += BOMBAREA_FLOOR_HEIGHT;
		tr = gi.trace(start, NULL, NULL, end, ent, MASK_SOLID);
	}
	else if (angles[PITCH] != CEILING_PITCH)
	{
		safe_cprintf(ent, PRINT_HIGH, "You must look at a ceiling or floor to cast this spell.\n");
		return;
	}

	bomb = G_Spawn();
	bomb->solid = SOLID_NOT;
	bomb->svflags |= SVF_NOCLIENT;
	VectorClear(bomb->velocity);
	VectorClear(bomb->mins);
	VectorClear(bomb->maxs);
	bomb->owner = ent;
	bomb->delay = level.time + BOMBAREA_DURATION + BOMBAREA_STARTUP_DELAY;
	bomb->nextthink = level.time + BOMBAREA_STARTUP_DELAY;
	bomb->dmg = 50 + 10*ent->myskills.abilities[BOMB_SPELL].current_level*skill_mult;
	bomb->think = bombarea_think;
	VectorCopy(tr.endpos, bomb->s.origin);
	VectorCopy(tr.endpos, bomb->s.old_origin);
	VectorCopy(angles, bomb->s.angles);
	gi.linkentity(bomb);

    gi.sound(bomb, CHAN_WEAPON, gi.soundindex("abilities/meteorlaunch_short.wav"), 1, ATTN_NORM, 0);
	ent->client->pers.inventory[power_cube_index] -= cost;

	ent->client->ability_delay = level.time + (DELAY_BOMB * cost_mult);
}
开发者ID:zardoru,项目名称:vrxcl,代码行数:60,代码来源:bombspell.c


示例8: CheckFlood

qboolean CheckFlood (edict_t *who)
{
	int	i;
	gclient_t *cl;

		cl = who->client;
		//DB
        if (level.time < cl->flood_locktill)
		{
			safe_cprintf(who, PRINT_HIGH, "You can't talk for %d more seconds\n",
				(int)(cl->flood_locktill - level.time));
            return false;
        }
        i = cl->flood_whenhead - flood_msgs->value + 1;
		if (i < 0)
            i = (sizeof(cl->flood_when)/sizeof(cl->flood_when[0])) + i;
		if (cl->flood_when[i] && level.time - cl->flood_when[i] < flood_persecond->value)
		{
			cl->flood_locktill = level.time + flood_waitdelay->value;
			safe_cprintf(who, PRINT_CHAT, "Flood protection:  You can't talk for %d seconds.\n",(int)flood_waitdelay->value);
            return false;
        }
		cl->flood_whenhead = (cl->flood_whenhead + 1) % (sizeof(cl->flood_when)/sizeof(cl->flood_when[0]));
		cl->flood_when[cl->flood_whenhead] = level.time;
		return true;
}
开发者ID:qbism,项目名称:tmg,代码行数:26,代码来源:g_utils.c


示例9: Cmd_HolyFreeze

void Cmd_HolyFreeze(edict_t *ent)
{
	qboolean sameaura=false;

	if (debuginfo->value)
		gi.dprintf("DEBUG: %s just called Cmd_HolyFreeze()\n", ent->client->pers.netname);

	if(ent->myskills.abilities[HOLY_FREEZE].disable)
		return;

	if (!G_CanUseAbilities(ent, ent->myskills.abilities[HOLY_FREEZE].current_level, 0))
		return;
	// if we already had an aura on, remove it
	if (que_typeexists(ent->auras, AURA_HOLYFREEZE))
	{
		safe_cprintf(ent, PRINT_HIGH, "Holy freeze removed.\n");
		AuraRemove(ent, AURA_HOLYFREEZE);
		return;
	}
	
	ent->client->ability_delay = level.time + DEFAULT_AURA_DELAY;
	// do we have enough power cubes?
	if (ent->client->pers.inventory[power_cube_index] < DEFAULT_AURA_INIT_COST)
	{
		safe_cprintf(ent, PRINT_HIGH, "You need more %d power cubes to use this ability.\n", 
			DEFAULT_AURA_INIT_COST-ent->client->pers.inventory[power_cube_index]);
		return;
	}
	ent->client->pers.inventory[power_cube_index] -= DEFAULT_AURA_INIT_COST;
	gi.sound(ent, CHAN_ITEM, gi.soundindex("auras/holywind.wav"), 1, ATTN_NORM, 0);
	safe_cprintf(ent, PRINT_HIGH, "Now using holy freeze aura.\n");
	aura_holyfreeze(ent);
}
开发者ID:emmamai,项目名称:vortex-indy,代码行数:33,代码来源:auras.c


示例10: depot_die

void depot_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	if (attacker->client)
		safe_cprintf(self->creator, PRINT_HIGH, "Your supply station was destroyed by %s.\n", attacker->client->pers.netname);
	else
		safe_cprintf(self->creator, PRINT_HIGH, "Your supply station was destroyed.\n");
	depot_remove(self, NULL, true);
}
开发者ID:zardoru,项目名称:vrxcl,代码行数:8,代码来源:supplystation.c


示例11: SVCmd_ListIP_f

/*
=================
SV_ListIP_f
=================
*/
void SVCmd_ListIP_f (void)
{
	int		i;
	byte	b[4];

	safe_cprintf (NULL, PRINT_HIGH, "Filter list:\n");
	for (i=0 ; i<numipfilters ; i++)
	{
		*(unsigned *)b = ipfilters[i].compare;
		safe_cprintf (NULL, PRINT_HIGH, "%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
	}
}
开发者ID:qbism,项目名称:qbq2,代码行数:17,代码来源:g_svcmds.c


示例12: ShowAllyMenu

void ShowAllyMenu (edict_t *ent)
{
	int i;
	int j = 0;
	edict_t *temp;

	//Don't bother displaying the menu if alliances are disabled
	if (!allies->value)
	{
		safe_cprintf(ent, PRINT_HIGH, "Alliances are disabled.\n");
		return;
	}

	// alliance only work in pvp mode
	if (!ValidAllyMode())
	{
		safe_cprintf(ent, PRINT_HIGH, "Alliances are disabled.\n");
		return;
	}

	 if (!ShowMenu(ent))
        return;
	clearmenu(ent);

	addlinetomenu(ent, "Currently allied with:", MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);

	for_each_player(temp, i)
	{
		if (IsAlly(ent, temp))
		{
			//Add player to the list
			addlinetomenu(ent, va(" %s", temp->myskills.player_name), 0);
			++j;
		}
	}

	//Menu footer
	addlinetomenu(ent, " ", 0);
	addlinetomenu(ent, "Add Ally", 1);
	addlinetomenu(ent, "Remove Ally", 2);
	addlinetomenu(ent, "Exit", 666);

	//Set handler
	setmenuhandler(ent, ShowAllyMenu_handler);

	//Set current line
	ent->client->menustorage.currentline = 6 + j;

	//Display the menu
	showmenu(ent);
}
开发者ID:emmamai,项目名称:vortex-indy,代码行数:52,代码来源:ally.c


示例13: ShowAllyInviteMenu_handler

void ShowAllyInviteMenu_handler (edict_t *ent, int option)
{
	edict_t *e = ent->client->allytarget;

	if (!e || !e->inuse)
		return;

	// make sure they can still ally
	if (!CanAlly(ent, e, ALLY_RANGE))
		return;

	if (option == 1)
	{
		// notify inviter and his previous allies, if any
		gi.centerprintf(e, "Now allied with %s\n", ent->client->pers.netname);
		NotifyAllies(e, CENTERPRINT, va("Now allied with %s\n", ent->client->pers.netname));

		// notify invitee's allies
		NotifyAllies(ent, CENTERPRINT, va("Now allied with %s\n", e->client->pers.netname));

		// join allies
		AddAlly(ent, e);

		// notify invitee
		safe_cprintf(ent, PRINT_HIGH, "Ally added.\n");

		// reset wait menu variables
		AbortAllyWait(ent);
		AbortAllyWait(e);

		// close the invitation menu
		closemenu(ent);

		if (InMenu(e, 0, ShowAllyWaitMenu_handler))
			closemenu(e);
	}
	else if (option == 2)
	{
		// reset wait menu variables
		AbortAllyWait(ent);
		AbortAllyWait(e);

		// close the invitation menu
		closemenu(ent);

		if (InMenu(e, 0, ShowAllyWaitMenu_handler))
			closemenu(e);

		safe_cprintf(e, PRINT_HIGH, "%s declined your offer to ally.\n", ent->client->pers.netname);
	}
}
开发者ID:emmamai,项目名称:vortex-indy,代码行数:51,代码来源:ally.c


示例14: Cmd_BuildLaser

void Cmd_BuildLaser (edict_t *ent)
{
	int talentLevel, cost=LASER_COST;
	float skill_mult=1.0, cost_mult=1.0, delay_mult=1.0;//Talent: Rapid Assembly & Precision Tuning

	if(ent->myskills.abilities[BUILD_LASER].disable)
		return;

	if (Q_strcasecmp (gi.args(), "remove") == 0)
	{
		RemoveLasers(ent);
		safe_cprintf(ent, PRINT_HIGH, "All lasers removed.\n");
		return;
	}

	// cost is doubled if you are a flyer or cacodemon below skill level 5
	if ((ent->mtype == MORPH_FLYER && ent->myskills.abilities[FLYER].current_level < 5) 
		|| (ent->mtype == MORPH_CACODEMON && ent->myskills.abilities[CACODEMON].current_level < 5))
		cost *= 2;

	//Talent: Rapid Assembly
	talentLevel = getTalentLevel(ent, TALENT_RAPID_ASSEMBLY);
	if (talentLevel > 0)
		delay_mult -= 0.1 * talentLevel;
	//Talent: Precision Tuning
	else if ((talentLevel = getTalentLevel(ent, TALENT_PRECISION_TUNING)) > 0)
	{
		cost_mult += PRECISION_TUNING_COST_FACTOR * talentLevel;
		delay_mult += PRECISION_TUNING_DELAY_FACTOR * talentLevel;
		skill_mult += PRECISION_TUNING_SKILL_FACTOR * talentLevel;
	}
	cost *= cost_mult;

	if (!G_CanUseAbilities(ent, ent->myskills.abilities[BUILD_LASER].current_level, cost))
		return;

	if (ent->num_lasers >= MAX_LASERS)
	{
		safe_cprintf(ent, PRINT_HIGH, "Can't build any more lasers.\n");
		return;
	}

	if (ctf->value && (CTF_DistanceFromBase(ent, NULL, CTF_GetEnemyTeam(ent->teamnum)) < CTF_BASE_DEFEND_RANGE))
	{
		safe_cprintf(ent, PRINT_HIGH, "Can't build in enemy base!\n");
		return;
	}

	SpawnLaser(ent, cost, skill_mult, delay_mult);
}
开发者ID:wafleh,项目名称:vrxcl,代码行数:50,代码来源:lasers.c


示例15: DeleteMenu_handler

void DeleteMenu_handler(edict_t *ent, int option)
{
	if (option - 777 > 0)
	{
		int i;

		//Delete item
		memset(&ent->myskills.items[option - 778], 0, sizeof(item_t));

		//Re-apply equipment
		V_ResetAllStats(ent);
		for (i = 0; i < 3; ++i)
			V_ApplyRune(ent, &ent->myskills.items[i]);

		safe_cprintf(ent, PRINT_HIGH, "Item deleted.\n");
	}
	else if (option - 666 > 0)
	{
		//Back to main
		ShowInventoryMenu(ent, option - 666, false);
		return;
	}
	else
	{
		//Closing menu
		closemenu(ent);
		return;
	}
}
开发者ID:emmamai,项目名称:vortex-indy,代码行数:29,代码来源:item.c


示例16: BombPerson

void BombPerson (edict_t *target, edict_t *owner, float skill_mult) 
{
	edict_t *bomb;

    gi.sound(target, CHAN_ITEM, gi.soundindex("abilities/meteorlaunch.wav"), 1, ATTN_NORM, 0);
	if ((target->client) && !(target->svflags & SVF_MONSTER))
		safe_cprintf(target, PRINT_HIGH, "SOMEONE SET UP US THE BOMB !!\n");
	//target->cursed |= CURSE_BOMBS;

	bomb=G_Spawn();
	bomb->solid = SOLID_NOT;
	bomb->svflags |= SVF_NOCLIENT;
	VectorClear(bomb->velocity);
	VectorClear(bomb->mins);
	VectorClear(bomb->maxs);
	bomb->owner = owner;
	bomb->enemy = target;
	bomb->delay = level.time + BOMBPERSON_DURATION;
	bomb->dmg = 50 + 10*owner->myskills.abilities[BOMB_SPELL].current_level*skill_mult;
	bomb->mtype = CURSE_BOMBS;
	bomb->nextthink = level.time + 1.0;
	bomb->think = bombperson_think;
	VectorCopy(target->s.origin, bomb->s.origin);
	gi.linkentity(bomb);
	if (!que_addent(target->curses, bomb, BOMBPERSON_DURATION))
		G_FreeEdict(bomb);
}
开发者ID:zardoru,项目名称:vrxcl,代码行数:27,代码来源:bombspell.c


示例17: objective_area_think

/*
========================
objective_area
========================
*/
void objective_area_think (edict_t *self) {

	edict_t *ent  = NULL;
	int count = 0;
	int newteam = 0;
	int delay;

	self->nextthink = level.time + FRAMETIME;

	if (self->delay) // if there's a counter running
	{
	}

	while ((ent = findradius(ent, self->s.origin, self->obj_area)) != NULL)
	{
		if (!ent->inuse)
			continue;
		if (!IsValidPlayer(ent))
			continue;

		newteam = ent->client->resp.team_on->index;

		if (newteam != self->obj_owner)
			count++;

		//gi.dprintf(DEVELOPER_MSG_GAME, "Found %d players\n", count);		
	}

	if (count >= self->obj_count) {

		team_list[self->obj_owner]->score -= self->obj_loss;

		self->obj_owner = team_list[newteam]->index;
		team_list[self->obj_owner]->score += self->obj_gain;

		if (team_list[self->obj_owner]->time_to_win) // If there already is a counter somwhere else
		{
			if (team_list[self->obj_owner]->time_to_win > (self->obj_time + level.time) )
			// If the counter is longer, shorten it up to this one
				team_list[self->obj_owner]->time_to_win = (self->obj_time + level.time);
		} else // there is no counter
			team_list[self->obj_owner]->time_to_win = (self->obj_time + level.time);

		delay = (int)(team_list[self->obj_owner]->time_to_win - level.time);

		if ((delay/60) >= 1)
			safe_bprintf(PRINT_HIGH, "Team %s has %i minutes before they win the battle.\n", team_list[self->obj_owner]->teamname, (delay/60));
		else
			safe_bprintf(PRINT_HIGH, "Team %s has %i seconds before they win the battle.\n", team_list[self->obj_owner]->teamname, delay);

		gi.sound(self, CHAN_NO_PHS_ADD, gi.soundindex(va("%s/objectives/area_cap.wav", team_list[self->obj_owner]->teamid)), 1, 0, 0);

		if (dedicated->value)
			safe_cprintf(NULL, PRINT_HIGH, "Objective %s taken by team %s!\n",  self->obj_name,  team_list[self->obj_owner]->teamname);

		centerprintall("Objective %s taken\n by team %s!\n", 
			self->obj_name, 
			team_list[self->obj_owner]->teamname);
	}
}
开发者ID:basecq,项目名称:q2dos,代码行数:65,代码来源:g_objectives.c


示例18: magmine_think

void magmine_think(edict_t *self) {
    // check for valid position
    if (gi.pointcontents(self->s.origin) & CONTENTS_SOLID) {
        gi.dprintf("WARNING: A mag mine was removed from map due to invalid position.\n");
        safe_cprintf(self->creator, PRINT_HIGH, "Your mag mine was removed.\n");
        self->creator->magmine = NULL;
        G_FreeEdict(self);
        return;
    }

    if (!self->enemy) {
        if (magmine_findtarget(self)) {
            magmine_attack(self);
            magmine_throwsparks(self);
        }
    } else if (G_ValidTarget(self, self->enemy, true)
               && (entdist(self, self->enemy) <= self->dmg_radius)) {
        magmine_attack(self);
        magmine_throwsparks(self);
    } else {
        self->enemy = NULL;
    }

    //magmine_seteffects(self);
    M_SetEffects(self);//4.5
    self->nextthink = level.time + FRAMETIME;
}
开发者ID:zardoru,项目名称:vrxcl,代码行数:27,代码来源:magmine.c


示例19: NotifyAllies

void NotifyAllies (edict_t *ent, int msgtype, char *s)
{
	int		i;
	edict_t *cl_ent;

	// no team assigned!
	if (!ent->teamnum)
		return;

	for (i=0 ; i<game.maxclients ; i++)
	{
		cl_ent = g_edicts+1+i;

		if (!cl_ent->inuse)
			continue;
		if (cl_ent->teamnum != ent->teamnum)
			continue;
		if (cl_ent == ent)
			continue;
		if (msgtype)
			gi.centerprintf(cl_ent, "%s", s);
		else
			safe_cprintf(cl_ent, PRINT_HIGH, "%s", s);
	}
}
开发者ID:emmamai,项目名称:vortex-indy,代码行数:25,代码来源:ally.c


示例20: depot_give_inventory

void depot_give_inventory (edict_t *self, edict_t *other)
{
	int result = 0;

	if ((self->sentrydelay > level.time) || !G_EntIsAlive(self) || !G_EntIsAlive(other) || !other->client || OnSameTeam(self, other) < 2)
		return;

	result += depot_give_item(self, other, body_armor_index);
	result += depot_give_item(self, other, bullet_index);
	result += depot_give_item(self, other, cell_index);
	result += depot_give_item(self, other, shell_index);
	result += depot_give_item(self, other, grenade_index);
	result += depot_give_item(self, other, rocket_index);
	result += depot_give_item(self, other, slug_index);

	safe_cprintf(other, PRINT_HIGH, "Depot has %d armor, %d bullets, %d cells, %d shells, %d grenades, %d rockets, %d slugs\n", 
		self->packitems[body_armor_index], self->packitems[bullet_index], self->packitems[cell_index], 
		self->packitems[shell_index], self->packitems[grenade_index], self->packitems[rocket_index], 
		self->packitems[slug_index]);

	// delay before depot can be used again
	self->sentrydelay = level.time + 2.0;

	if (result > 0)
		gi.sound(self, CHAN_ITEM, gi.soundindex("misc/w_pkup.wav"), 1, ATTN_STATIC, 0);
}
开发者ID:zardoru,项目名称:vrxcl,代码行数:26,代码来源:supplystation.c



注:本文中的safe_cprintf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ safe_delete函数代码示例发布时间:2022-05-30
下一篇:
C++ safe_closehandle函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap