예제 #1
0
파일: g_cmds.c 프로젝트: Razish/QtZ
static void Cmd_GiveOther_f( gentity_t *ent ) {
	char		name[MAX_TOKEN_CHARS] = {0};
	int			i;
	char		otherindex[MAX_TOKEN_CHARS];
	gentity_t	*otherEnt = NULL;

	trap->Cmd_Argv( 1, otherindex, sizeof( otherindex ) );
	if ( !otherindex[0] )
	{
		trap->SV_GameSendServerCommand( ARRAY_INDEX( g_entities, ent ), "print \"giveother requires that the second argument be a client index number.\n\"" );
		return;
	}

	i = atoi( otherindex );
	if ( i < 0 || i >= MAX_CLIENTS )
	{
		trap->SV_GameSendServerCommand( ARRAY_INDEX( g_entities, ent ), va( "print \"%i is not a client index.\n\"", i ) );
		return;
	}

	otherEnt = &g_entities[i];
	if ( !otherEnt->inuse || !otherEnt->client )
	{
		trap->SV_GameSendServerCommand( ARRAY_INDEX( g_entities, ent ), va( "print \"%i is not an active client.\n\"", i ) );
		return;
	}

	trap->Cmd_Argv( 2, name, sizeof( name ) );

	G_Give( otherEnt, name, ConcatArgs( 3 ), trap->Cmd_Argc()-1 );
}
예제 #2
0
파일: g_cmds.cpp 프로젝트: archSeer/OpenJK
void Cmd_Give_f( gentity_t *ent )
{
	if ( !CheatsOk( ent ) ) {
		return;
	}

	G_Give( ent, gi.argv(1), ConcatArgs( 2 ), gi.argc() );
}
예제 #3
0
파일: g_client.c 프로젝트: darkshade9/aq2w
/*
 * G_GiveLevelLocals
 */
static boolean_t G_GiveLevelLocals(g_client_t *client) {
	char buf[512], *it, *q;
	int quantity;

	if (*g_level.give == '\0')
		return false;

	strncpy(buf, g_level.give, sizeof(buf));

	it = strtok(buf, ",");

	while (true) {

		if (!it)
			break;

		it = Trim(it);

		if (*it != '\0') {

			if ((q = strrchr(it, ' '))) {
				quantity = atoi(q + 1);

				if (quantity > -1) // valid quantity
					*q = 0;
			} else
				quantity = -1;

			G_Give(client, it, quantity);
		}

		it = strtok(NULL, ",");
	}

	return true;
}
예제 #4
0
파일: g_cmds.c 프로젝트: Razish/QtZ
static void Cmd_Give_f( gentity_t *ent ) {
	char name[MAX_TOKEN_CHARS] = {0};

	trap->Cmd_Argv( 1, name, sizeof( name ) );
	G_Give( ent, name, ConcatArgs( 2 ), trap->Cmd_Argc() );
}