Exemple #1
0
bool HoldableItemProtection::use( void )
{
	Event *event;

	if ( _owner && !multiplayerManager.checkFlag( MP_FLAG_NO_POWERUPS ) )
	{
		if ( !_owner->isSubclassOf( Player ) )
			return false;

		Powerup *powerup;
		Player *player;

		player = (Player *)_owner;

		powerup = Powerup::CreatePowerup( "Protection", "models/item/powerup_protection.tik", player );

		event = new Event( EV_Item_SetAmount );
		event->AddFloat( 15.0f );
		powerup->ProcessEvent( event );

		if ( powerup )
		{
			player->setPowerup( powerup );
			return true;
		}
	}

	return false;
}
Exemple #2
0
void Powerup::givePlayerItem( Player *player )
{
	Powerup *powerup;
	const char *modelName;

	modelName = gi.NameForNum( edict->s.modelindex );

	if ( !modelName )
		return;

	powerup = Powerup::CreatePowerup( item_name, modelName, player );

	Event *event = new Event( EV_Item_SetAmount );
	event->AddFloat( amount );
	powerup->ProcessEvent( event );

	player->setPowerup( powerup );
}